Skip to content

Commit

Permalink
calculate ancient slot boundary correctly for hash calc (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Aug 5, 2024
1 parent 7a9317f commit 4e5af1e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions accounts-db/src/accounts_db/scan_account_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,18 @@ impl AccountsDb {
where
S: AppendVecScan,
{
let oldest_non_ancient_slot = self.get_oldest_non_ancient_slot_for_hash_calc_scan(
snapshot_storages.max_slot_inclusive(),
config,
);
let splitter = SplitAncientStorages::new(oldest_non_ancient_slot, snapshot_storages);

let oldest_non_ancient_slot_for_split = self
.get_oldest_non_ancient_slot_for_hash_calc_scan(
snapshot_storages.max_slot_inclusive(),
config,
);
let splitter =
SplitAncientStorages::new(oldest_non_ancient_slot_for_split, snapshot_storages);
let oldest_non_ancient_slot_for_identification = self
.get_oldest_non_ancient_slot_from_slot(
config.epoch_schedule,
snapshot_storages.max_slot_inclusive(),
);
let slots_per_epoch = config
.rent_collector
.epoch_schedule
Expand Down Expand Up @@ -297,10 +303,7 @@ impl AccountsDb {
let mut init_accum = true;
// load from cache failed, so create the cache file for this chunk
for (slot, storage) in snapshot_storages.iter_range(&range_this_chunk) {
let ancient =
oldest_non_ancient_slot.is_some_and(|oldest_non_ancient_slot| {
slot < oldest_non_ancient_slot
});
let ancient = slot < oldest_non_ancient_slot_for_identification;

let (_, scan_us) = measure_us!(if let Some(storage) = storage {
if init_accum {
Expand Down

0 comments on commit 4e5af1e

Please sign in to comment.