slots_per_epoch shouldn't be optional (#27256)

This commit is contained in:
apfitzge 2022-08-22 11:15:48 -04:00 committed by GitHub
parent 7fda0287cb
commit 9d5029da15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 15 deletions

View File

@ -6664,20 +6664,18 @@ impl AccountsDb {
}
/// storages are sorted by slot and have range info.
/// if we know slots_per_epoch, then add all stores older than slots_per_epoch to dirty_stores so clean visits these slots
fn mark_old_slots_as_dirty(&self, storages: &SortedStorages, slots_per_epoch: Option<Slot>) {
if let Some(slots_per_epoch) = slots_per_epoch {
let max = storages.max_slot_inclusive();
let acceptable_straggler_slot_count = 100; // do nothing special for these old stores which will likely get cleaned up shortly
let sub = slots_per_epoch + acceptable_straggler_slot_count;
let in_epoch_range_start = max.saturating_sub(sub);
for (slot, storages) in storages.iter_range(..in_epoch_range_start) {
if let Some(storages) = storages {
storages.iter().for_each(|store| {
self.dirty_stores
.insert((slot, store.append_vec_id()), store.clone());
});
}
/// add all stores older than slots_per_epoch to dirty_stores so clean visits these slots
fn mark_old_slots_as_dirty(&self, storages: &SortedStorages, slots_per_epoch: Slot) {
let max = storages.max_slot_inclusive();
let acceptable_straggler_slot_count = 100; // do nothing special for these old stores which will likely get cleaned up shortly
let sub = slots_per_epoch + acceptable_straggler_slot_count;
let in_epoch_range_start = max.saturating_sub(sub);
for (slot, storages) in storages.iter_range(..in_epoch_range_start) {
if let Some(storages) = storages {
storages.iter().for_each(|store| {
self.dirty_stores
.insert((slot, store.append_vec_id()), store.clone());
});
}
}
}
@ -6916,7 +6914,7 @@ impl AccountsDb {
"cannot accurately capture all data for debugging if accounts cache is being used"
);
self.mark_old_slots_as_dirty(storages, Some(config.epoch_schedule.slots_per_epoch));
self.mark_old_slots_as_dirty(storages, config.epoch_schedule.slots_per_epoch);
let (num_hash_scan_passes, bins_per_pass) = Self::bins_per_pass(self.num_hash_scan_passes);
let use_bg_thread_pool = config.use_bg_thread_pool;