Fix blockstore_processor::load_frozen_forks() halt_at_slot behavior (#28317)
load_frozen_forks() finds new slots to process by creating new Banks for the children of the current slot in process_next_slots(). Prior to this change, we would then immediately check if we had reached the halt_at_slot and correctly halt processing when appropriate. As such, it would be possible for Banks to be created for slots beyond the halt_at_slot. While a potential child slot that is past halt_at_slot wouldn't be replayed, the Bank being created still alters some universal state in AccountsDb. So, this change moves the halt_at_slot check before we create children Banks in process_next_slots().
This commit is contained in:
parent
cc390f176c
commit
2929c8f7a2
|
@ -1440,9 +1440,8 @@ fn load_frozen_forks(
|
||||||
&mut pending_slots,
|
&mut pending_slots,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let halt_at_slot = opts.halt_at_slot.unwrap_or(std::u64::MAX);
|
|
||||||
let on_halt_store_hash_raw_data_for_debug = opts.on_halt_store_hash_raw_data_for_debug;
|
let on_halt_store_hash_raw_data_for_debug = opts.on_halt_store_hash_raw_data_for_debug;
|
||||||
if bank_forks.read().unwrap().root() != halt_at_slot {
|
if Some(bank_forks.read().unwrap().root()) != opts.halt_at_slot {
|
||||||
let mut set_root_us = 0;
|
let mut set_root_us = 0;
|
||||||
let mut root_retain_us = 0;
|
let mut root_retain_us = 0;
|
||||||
let mut process_single_slot_us = 0;
|
let mut process_single_slot_us = 0;
|
||||||
|
@ -1588,6 +1587,17 @@ fn load_frozen_forks(
|
||||||
slot,
|
slot,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let done_processing = opts
|
||||||
|
.halt_at_slot
|
||||||
|
.map(|halt_at_slot| slot >= halt_at_slot)
|
||||||
|
.unwrap_or(false);
|
||||||
|
if done_processing {
|
||||||
|
if opts.run_final_accounts_hash_calc {
|
||||||
|
run_final_hash_calc(&bank, on_halt_store_hash_raw_data_for_debug);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
process_next_slots(
|
process_next_slots(
|
||||||
&bank,
|
&bank,
|
||||||
&meta,
|
&meta,
|
||||||
|
@ -1595,13 +1605,6 @@ fn load_frozen_forks(
|
||||||
leader_schedule_cache,
|
leader_schedule_cache,
|
||||||
&mut pending_slots,
|
&mut pending_slots,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if slot >= halt_at_slot {
|
|
||||||
if opts.run_final_accounts_hash_calc {
|
|
||||||
run_final_hash_calc(&bank, on_halt_store_hash_raw_data_for_debug);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if on_halt_store_hash_raw_data_for_debug {
|
} else if on_halt_store_hash_raw_data_for_debug {
|
||||||
run_final_hash_calc(
|
run_final_hash_calc(
|
||||||
|
|
Loading…
Reference in New Issue