Skip to content

Commit

Permalink
don't evict zeros and don't scan disk for clean
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Sep 6, 2024
1 parent 5716b7e commit f5a88c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@ impl AccountsDb {
}
}
None => {
// This pubkey is in the index but not in a root slot, so clean
// This pubkey is in the index but not in a root slot or contains a zero account, so clean
// it up by adding it to the to-be-purged list.
//
// Also, this pubkey must have been touched by some slot since
Expand All @@ -3440,7 +3440,7 @@ impl AccountsDb {
},
None,
false,
ScanFilter::All,
self.scan_filter_for_shrinking,
);
});
found_not_zero_accum.fetch_add(found_not_zero, Ordering::Relaxed);
Expand Down
6 changes: 4 additions & 2 deletions accounts-db/src/accounts_index/in_mem_accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,10 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> InMemAccountsIndex<T,
}
(false, None) // keep 0 and > 1 slot lists in mem. They will be cleaned or shrunk soon.
} else {
// keep items with slot lists that contained cached items
let evict = !slot_list.iter().any(|(_, info)| info.is_cached());
// keep items with slot lists that contained cached items or zero lamports
let evict = !slot_list
.iter()
.any(|(_, info)| info.is_cached() || info.is_zero_lamport());
if !evict && update_stats {
Self::update_stat(&self.stats().held_in_mem.slot_list_cached, 1);
}
Expand Down

0 comments on commit f5a88c7

Please sign in to comment.