From 184469c1f03f1edd1e04ae396b50423276e0de16 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 28 Aug 2024 15:34:16 -0500 Subject: [PATCH] add comment (#2775) --- accounts-db/src/accounts_db.rs | 3 +++ 1 file changed, 3 insertions(+) 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.