add _inclusive (#27335)

This commit is contained in:
Jeff Washington (jwash) 2022-08-23 14:19:04 -05:00 committed by GitHub
parent 7f4dc496ef
commit a5c5d70c1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -1689,23 +1689,25 @@ impl<T: IndexValue> AccountsIndex<T> {
&self,
slot_list: &mut SlotList<T>,
reclaims: &mut SlotList<T>,
max_clean_root: Option<Slot>,
max_clean_root_inclusive: Option<Slot>,
) {
let newest_root_in_slot_list;
let max_clean_root = {
let max_clean_root_inclusive = {
let roots_tracker = &self.roots_tracker.read().unwrap();
newest_root_in_slot_list = Self::get_newest_root_in_slot_list(
&roots_tracker.alive_roots,
slot_list,
max_clean_root,
max_clean_root_inclusive,
);
max_clean_root.unwrap_or_else(|| roots_tracker.alive_roots.max_inclusive())
max_clean_root_inclusive.unwrap_or_else(|| roots_tracker.alive_roots.max_inclusive())
};
slot_list.retain(|(slot, value)| {
let should_purge =
Self::can_purge_older_entries(max_clean_root, newest_root_in_slot_list, *slot)
&& !value.is_cached();
let should_purge = Self::can_purge_older_entries(
max_clean_root_inclusive,
newest_root_in_slot_list,
*slot,
) && !value.is_cached();
if should_purge {
reclaims.push((*slot, *value));
}