@ -1376,12 +1376,14 @@ impl AccountsDB {
|
||||
let index = self.accounts_index.read().unwrap();
|
||||
let storage = self.storage.read().unwrap();
|
||||
for slot in dead_slots.iter() {
|
||||
for store in storage.0.get(slot).unwrap().values() {
|
||||
if let Some(slot_storage) = storage.0.get(slot) {
|
||||
for store in slot_storage.values() {
|
||||
for account in store.accounts.accounts(0) {
|
||||
index.unref_from_storage(&account.meta.pubkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
drop(storage);
|
||||
drop(index);
|
||||
measure.stop();
|
||||
@ -3373,4 +3375,12 @@ pub mod tests {
|
||||
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
|
||||
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clean_dead_slots_empty() {
|
||||
let accounts = AccountsDB::new_single();
|
||||
let mut dead_slots = HashSet::new();
|
||||
dead_slots.insert(10);
|
||||
accounts.clean_dead_slots(&mut dead_slots);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user