SortedStorages::max_slot_inclusive() (#25153)

This commit is contained in:
Jeff Washington (jwash) 2022-05-12 10:24:03 -05:00 committed by GitHub
parent 849cbe93aa
commit abb4993a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -5623,7 +5623,7 @@ impl AccountsDb {
// 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.range().end;
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);
@ -5796,7 +5796,7 @@ impl AccountsDb {
config.epoch_schedule,
config.rent_collector,
stats,
storage.range().end.saturating_sub(1), // 'end' is exclusive, convert to inclusive
storage.max_slot_inclusive(),
find_unskipped_slot,
filler_account_suffix,
);
@ -5920,8 +5920,8 @@ impl AccountsDb {
}
info!(
"calculate_accounts_hash_without_index: slot (exclusive): {} {:?}",
storages.range().end,
"calculate_accounts_hash_without_index: slot: {} {:?}",
storages.max_slot_inclusive(),
final_result
);
Ok(final_result)

View File

@ -52,6 +52,10 @@ impl<'a> SortedStorages<'a> {
&self.range
}
pub fn max_slot_inclusive(&self) -> Slot {
self.range.end.saturating_sub(1)
}
pub fn slot_count(&self) -> usize {
self.slot_count
}