Replaces ReadAccountMapEntry in snapshot minimizer (#35237)

This commit is contained in:
Brooks 2024-02-20 13:52:29 -05:00 committed by GitHub
parent 0b5cc03aa3
commit 915faaba1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 14 deletions

View File

@ -256,15 +256,23 @@ impl<'a> SnapshotMinimizer<'a> {
fn get_minimized_slot_set(&self) -> DashSet<Slot> {
let minimized_slot_set = DashSet::new();
self.minimized_account_set.par_iter().for_each(|pubkey| {
if let Some(read_entry) = self
.accounts_db()
self.accounts_db()
.accounts_index
.get_account_read_entry(&pubkey)
{
if let Some(max_slot) = read_entry.slot_list().iter().map(|(slot, _)| *slot).max() {
minimized_slot_set.insert(max_slot);
}
}
.get_and_then(&pubkey, |entry| {
if let Some(entry) = entry {
let max_slot = entry
.slot_list
.read()
.unwrap()
.iter()
.map(|(slot, _)| *slot)
.max();
if let Some(max_slot) = max_slot {
minimized_slot_set.insert(max_slot);
}
}
(false, ())
});
});
minimized_slot_set
}
@ -321,12 +329,7 @@ impl<'a> SnapshotMinimizer<'a> {
if self.minimized_account_set.contains(account.pubkey()) {
chunk_bytes += account.stored_size();
keep_accounts.push(account);
} else if self
.accounts_db()
.accounts_index
.get_account_read_entry(account.pubkey())
.is_some()
{
} else if self.accounts_db().accounts_index.contains(account.pubkey()) {
purge_pubkeys.push(account.pubkey());
}
});