Skip to content

Commit

Permalink
Removes slot param from shrink_storage() (#2886)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Sep 12, 2024
1 parent 43b5830 commit d7011b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4353,7 +4353,9 @@ impl AccountsDb {
);
}

fn do_shrink_slot_store(&self, slot: Slot, store: &AccountStorageEntry) {
/// Shrinks `store` by rewriting the alive accounts to a new storage
fn shrink_storage(&self, store: &AccountStorageEntry) {
let slot = store.slot();
if self.accounts_cache.contains(slot) {
// It is not correct to shrink a slot while it is in the write cache until flush is complete and the slot is removed from the write cache.
// There can exist a window after a slot is made a root and before the write cache flushing for that slot begins and then completes.
Expand Down Expand Up @@ -4555,10 +4557,9 @@ impl AccountsDb {
.storage
.get_slot_storage_entry_shrinking_in_progress_ok(slot)
{
if !Self::is_shrinking_productive(slot, &store) {
return;
if Self::is_shrinking_productive(slot, &store) {
self.shrink_storage(&store)
}
self.do_shrink_slot_store(slot, &store)
}
}

Expand Down Expand Up @@ -5104,7 +5105,7 @@ impl AccountsDb {
.fetch_add(1, Ordering::Relaxed);
}
let mut measure = Measure::start("shrink_candidate_slots-ms");
self.do_shrink_slot_store(slot, &slot_shrink_candidate);
self.shrink_storage(&slot_shrink_candidate);
measure.stop();
inc_new_counter_info!("shrink_candidate_slots-ms", measure.as_ms() as usize);
});
Expand Down

0 comments on commit d7011b5

Please sign in to comment.