diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 9f43360e4f1b71..17d92aff4e2daf 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -1233,6 +1233,7 @@ impl AccountStorageEntry { } } + /// returns # of accounts remaining in the storage fn remove_accounts( &self, num_bytes: usize, @@ -8030,11 +8031,13 @@ impl AccountsDb { store.slot(), *slot ); if offsets.len() == store.count() { + // all remaining alive accounts in the storage are being removed, so the entire storage/slot is dead store.remove_accounts(store.alive_bytes(), reset_accounts, offsets.len()); self.dirty_stores.insert(*slot, store.clone()); dead_slots.insert(*slot); } else { + // not all accounts are being removed, so figure out sizes of accounts we are removing and update the alive bytes and alive account count let (_, us) = measure_us!({ let mut offsets = offsets.iter().cloned().collect::>(); // sort so offsets are in order. This improves efficiency of loading the accounts.