Skip sleeping in replay stage if a bank was recently processed (#5161)

* Skip sleeping in replay stage if a bank was recently processed

* Remove return
This commit is contained in:
Sagar Dhawan 2019-07-18 12:04:53 -07:00 committed by GitHub
parent 488dd0e563
commit 751b54b60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -123,13 +123,13 @@ impl ReplayStage {
&leader_schedule_cache, &leader_schedule_cache,
); );
Self::replay_active_banks( let did_process_bank = Self::replay_active_banks(
&blocktree, &blocktree,
&bank_forks, &bank_forks,
&my_pubkey, &my_pubkey,
&mut progress, &mut progress,
&slot_full_sender, &slot_full_sender,
)?; );
let votable = Self::generate_votable_banks(&bank_forks, &tower, &mut progress); let votable = Self::generate_votable_banks(&bank_forks, &tower, &mut progress);
@ -170,6 +170,10 @@ impl ReplayStage {
"replicate_stage-duration", "replicate_stage-duration",
duration_as_ms(&now.elapsed()) as usize duration_as_ms(&now.elapsed()) as usize
); );
if did_process_bank {
//just processed a bank, skip the signal; maybe there's more slots available
continue;
}
let timer = Duration::from_millis(100); let timer = Duration::from_millis(100);
let result = ledger_signal_receiver.recv_timeout(timer); let result = ledger_signal_receiver.recv_timeout(timer);
match result { match result {
@ -416,7 +420,8 @@ impl ReplayStage {
my_pubkey: &Pubkey, my_pubkey: &Pubkey,
progress: &mut HashMap<u64, ForkProgress>, progress: &mut HashMap<u64, ForkProgress>,
slot_full_sender: &Sender<(u64, Pubkey)>, slot_full_sender: &Sender<(u64, Pubkey)>,
) -> Result<()> { ) -> bool {
let mut did_process_bank = false;
let active_banks = bank_forks.read().unwrap().active_banks(); let active_banks = bank_forks.read().unwrap().active_banks();
trace!("active banks {:?}", active_banks); trace!("active banks {:?}", active_banks);
@ -439,6 +444,7 @@ impl ReplayStage {
} }
assert_eq!(*bank_slot, bank.slot()); assert_eq!(*bank_slot, bank.slot());
if bank.tick_height() == bank.max_tick_height() { if bank.tick_height() == bank.max_tick_height() {
did_process_bank = true;
Self::process_completed_bank(my_pubkey, bank, slot_full_sender); Self::process_completed_bank(my_pubkey, bank, slot_full_sender);
} else { } else {
trace!( trace!(
@ -449,8 +455,7 @@ impl ReplayStage {
); );
} }
} }
did_process_bank
Ok(())
} }
fn generate_votable_banks( fn generate_votable_banks(