Skip to content

Commit

Permalink
Reclaims more old accounts in clean (#4044)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3d43824)

# Conflicts:
#	accounts-db/src/accounts_db.rs
#	accounts-db/src/accounts_db/tests.rs
  • Loading branch information
brooksprumo authored and mergify[bot] committed Dec 12, 2024
1 parent 0125110 commit 431e1c4
Show file tree
Hide file tree
Showing 3 changed files with 8,281 additions and 0 deletions.
17 changes: 17 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,19 @@ impl AccountsDb {
} else {
found_not_zero += 1;
}

// If this candidate has multiple rooted slot list entries,
// we should reclaim the older ones.
if slot_list.len() > 1
&& *slot
<= max_clean_root_inclusive.unwrap_or(Slot::MAX)
{
should_collect_reclaims = true;
purges_old_accounts_local += 1;
useless = false;
}
// Note, this next if-block is only kept to maintain the
// `uncleaned_roots_slot_list_1` stat.
if uncleaned_roots.contains(slot) {
// Assertion enforced by `accounts_index.get()`, the latest slot
// will not be greater than the given `max_clean_root`
Expand All @@ -2800,12 +2813,16 @@ impl AccountsDb {
{
assert!(slot <= &max_clean_root_inclusive);
}
<<<<<<< HEAD
if slot_list.len() > 1 {
// no need to purge old accounts if there is only 1 slot in the slot list
should_purge = true;
purges_old_accounts_local += 1;
useless = false;
} else {
=======
if slot_list.len() == 1 {
>>>>>>> 3d43824154 (Reclaims more old accounts in `clean` (#4044))
self.clean_accounts_stats
.uncleaned_roots_slot_list_1
.fetch_add(1, Ordering::Relaxed);
Expand Down
Loading

0 comments on commit 431e1c4

Please sign in to comment.