Skip to content

Commit

Permalink
pr: get the max alive root from the index, and check against that
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Nov 24, 2024
1 parent f66574b commit 063e7a5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8474,22 +8474,19 @@ impl AccountsDb {
requested_slots: impl RangeBounds<Slot> + Sync,
) -> (Vec<Arc<AccountStorageEntry>>, Vec<Slot>) {
let start = Instant::now();
// Clone the alive roots RollingBitField from the index so we never need to grab the read
// lock again. There should not be any excess slots (there would have to be more than
// 4 *million* alive roots!), so the total size here is under half a megabyte.
let alive_roots = self
let max_alive_root_exclusive = self
.accounts_index
.roots_tracker
.read()
.unwrap()
.alive_roots
.clone();
.max_exclusive();
let (slots, storages) = self
.storage
.get_if(|slot, storage| {
requested_slots.contains(slot)
(*slot < max_alive_root_exclusive)
&& requested_slots.contains(slot)
&& storage.has_accounts()
&& alive_roots.contains(slot)
})
.into_vec()
.into_iter()
Expand Down

0 comments on commit 063e7a5

Please sign in to comment.