Skip to content

Commit

Permalink
Count and dump the number of purges_old_accounts in clean_accounts (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmakarov authored Aug 15, 2024
1 parent d4df4f8 commit 2e6ca8c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3258,6 +3258,7 @@ impl AccountsDb {
let _guard = self.active_stats.activate(ActiveStatItem::Clean);

let ancient_account_cleans = AtomicU64::default();
let purges_old_accounts_count = AtomicU64::default();

let mut measure_all = Measure::start("clean_accounts");
let max_clean_root_inclusive = self.max_clean_root(max_clean_root_inclusive);
Expand Down Expand Up @@ -3287,6 +3288,7 @@ impl AccountsDb {
let mut not_found_on_fork = 0;
let mut missing = 0;
let mut useful = 0;
let mut purges_old_accounts_local = 0;
let mut candidates_bin = candidates_bin.write().unwrap();
// Iterate over each HashMap entry to
// avoid capturing the HashMap in the
Expand Down Expand Up @@ -3337,6 +3339,7 @@ impl AccountsDb {
if slot_list.len() > 1 {
// no need to purge old accounts if there is only 1 slot in the slot list
candidate_info.should_purge = true;
purges_old_accounts_local += 1;
useless = false;
} else {
self.clean_accounts_stats
Expand All @@ -3354,6 +3357,7 @@ impl AccountsDb {
// touched in must be unrooted.
not_found_on_fork += 1;
candidate_info.should_purge = true;
purges_old_accounts_local += 1;
useless = false;
}
}
Expand All @@ -3373,6 +3377,7 @@ impl AccountsDb {
not_found_on_fork_accum.fetch_add(not_found_on_fork, Ordering::Relaxed);
missing_accum.fetch_add(missing, Ordering::Relaxed);
useful_accum.fetch_add(useful, Ordering::Relaxed);
purges_old_accounts_count.fetch_add(purges_old_accounts_local, Ordering::Relaxed);
});
};
if is_startup {
Expand Down Expand Up @@ -3651,6 +3656,11 @@ impl AccountsDb {
ancient_account_cleans.load(Ordering::Relaxed),
i64
),
(
"purges_old_accounts_count",
purges_old_accounts_count.load(Ordering::Relaxed),
i64
),
("next_store_id", self.next_id.load(Ordering::Relaxed), i64),
);
}
Expand Down

0 comments on commit 2e6ca8c

Please sign in to comment.