cleanup a stat call to `is_ancient` (#31621)

cleanup some calls to `is_ancient`
This commit is contained in:
Jeff Washington (jwash) 2023-05-15 15:22:15 -05:00 committed by GitHub
parent 656d93d805
commit 6172b0d50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -7086,13 +7086,11 @@ impl AccountsDb {
where
S: AppendVecScan,
{
let splitter = SplitAncientStorages::new(
self.get_oldest_non_ancient_slot_for_hash_calc_scan(
snapshot_storages.max_slot_inclusive(),
config,
),
snapshot_storages,
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);
stats.scan_chunks = splitter.chunk_count;
(0..splitter.chunk_count)
@ -7152,9 +7150,8 @@ 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 mut ancient = false;
let ancient = slot < oldest_non_ancient_slot;
let (_, scan_us) = measure_us!(if let Some(storage) = storage {
ancient = is_ancient(&storage.accounts);
if init_accum {
let range = bin_range.end - bin_range.start;
scanner.init_accum(range);