shrink_slot_forced uses a single append vec (#29521)

This commit is contained in:
Jeff Washington (jwash) 2023-01-05 12:38:05 -06:00 committed by GitHub
parent d87128e02c
commit d3f45c6901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -4069,12 +4069,11 @@ impl AccountsDb {
fn shrink_slot_forced(&self, slot: Slot) -> usize {
debug!("shrink_slot_forced: slot: {}", slot);
if let Some(stores_lock) = self.storage.get_slot_stores(slot) {
let stores: SnapshotStorage = stores_lock.read().unwrap().values().cloned().collect();
if !Self::is_shrinking_productive(slot, stores.iter()) {
if let Some(store) = self.storage.get_slot_storage_entry(slot) {
if !Self::is_shrinking_productive(slot, std::iter::once(&store)) {
return 0;
}
self.do_shrink_slot_stores(slot, stores.iter())
self.do_shrink_slot_stores(slot, std::iter::once(&store))
} else {
0
}