Skip to content

Commit

Permalink
split hash calc ancient slot boundary to allow for ancient shrinking …
Browse files Browse the repository at this point in the history
…to be behind
  • Loading branch information
jeffwashington committed Sep 18, 2023
1 parent 659fc68 commit b21f30c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1774,10 +1774,25 @@ impl SplitAncientStorages {
snapshot_storages: &SortedStorages,
) -> Vec<Slot> {
let range = snapshot_storages.range();
snapshot_storages
let mut i = 0;
let mut i_last_large_capacity = usize::MAX;
let mut possible_ancient_slots = snapshot_storages
.iter_range(&(range.start..oldest_non_ancient_slot))
.filter_map(|(slot, storage)| storage.map(|_| slot))
.collect()
.filter_map(|(slot, storage)| {
storage.map(|storage| {
if storage.capacity() > get_ancient_append_vec_capacity() * 50 / 100 {
// even though the slot is in range of being an ancient append vec, if it isn't actually a large append vec,
// then we are better off treating all these slots as normally cachable to reduce work in dedup.
// Since this one is large, for the moment, this one becomes the highest slot where we want to individually cache files.
i_last_large_capacity = i;
}
i += 1;
slot
})
})
.collect::<Vec<_>>();
possible_ancient_slots.truncate(i_last_large_capacity);
possible_ancient_slots
}

/// create once ancient slots have been identified
Expand Down

0 comments on commit b21f30c

Please sign in to comment.