stats on clean for removing roots (#16849)
* stats on clean for removing roots * rename * accumulate and swap metrics
This commit is contained in:
parent
9218b51de7
commit
9070191b8b
|
@ -951,6 +951,8 @@ struct LatestAccountsIndexRootsStats {
|
|||
uncleaned_roots_len: AtomicUsize,
|
||||
previous_uncleaned_roots_len: AtomicUsize,
|
||||
roots_range: AtomicU64,
|
||||
rooted_cleaned_count: AtomicUsize,
|
||||
unrooted_cleaned_count: AtomicUsize,
|
||||
}
|
||||
|
||||
impl LatestAccountsIndexRootsStats {
|
||||
|
@ -967,6 +969,14 @@ impl LatestAccountsIndexRootsStats {
|
|||
);
|
||||
self.roots_range
|
||||
.store(accounts_index_roots_stats.roots_range, Ordering::Relaxed);
|
||||
self.rooted_cleaned_count.fetch_add(
|
||||
accounts_index_roots_stats.rooted_cleaned_count,
|
||||
Ordering::Relaxed,
|
||||
);
|
||||
self.unrooted_cleaned_count.fetch_add(
|
||||
accounts_index_roots_stats.unrooted_cleaned_count,
|
||||
Ordering::Relaxed,
|
||||
);
|
||||
}
|
||||
|
||||
fn report(&self) {
|
||||
|
@ -992,6 +1002,16 @@ impl LatestAccountsIndexRootsStats {
|
|||
self.roots_range.load(Ordering::Relaxed) as i64,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"unrooted_cleaned_count",
|
||||
self.unrooted_cleaned_count.swap(0, Ordering::Relaxed) as i64,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"rooted_cleaned_count",
|
||||
self.rooted_cleaned_count.swap(0, Ordering::Relaxed) as i64,
|
||||
i64
|
||||
),
|
||||
);
|
||||
|
||||
// Don't need to reset since this tracks the latest updates, not a cumulative total
|
||||
|
@ -4418,17 +4438,25 @@ impl AccountsDb {
|
|||
}
|
||||
|
||||
let mut accounts_index_root_stats = AccountsIndexRootsStats::default();
|
||||
let mut rooted_cleaned_count = 0;
|
||||
let mut unrooted_cleaned_count = 0;
|
||||
let dead_slots: Vec<_> = dead_slots_iter
|
||||
.clone()
|
||||
.map(|slot| {
|
||||
if let Some(latest) = self.accounts_index.clean_dead_slot(*slot) {
|
||||
rooted_cleaned_count += 1;
|
||||
accounts_index_root_stats = latest;
|
||||
} else {
|
||||
unrooted_cleaned_count += 1;
|
||||
}
|
||||
*slot
|
||||
})
|
||||
.collect();
|
||||
info!("finalize_dead_slot_removal: slots {:?}", dead_slots);
|
||||
|
||||
accounts_index_root_stats.rooted_cleaned_count += rooted_cleaned_count;
|
||||
accounts_index_root_stats.unrooted_cleaned_count += unrooted_cleaned_count;
|
||||
|
||||
self.clean_accounts_stats
|
||||
.latest_accounts_index_roots_stats
|
||||
.update(&accounts_index_root_stats);
|
||||
|
|
|
@ -347,6 +347,8 @@ pub struct AccountsIndexRootsStats {
|
|||
pub uncleaned_roots_len: usize,
|
||||
pub previous_uncleaned_roots_len: usize,
|
||||
pub roots_range: u64,
|
||||
pub rooted_cleaned_count: usize,
|
||||
pub unrooted_cleaned_count: usize,
|
||||
}
|
||||
|
||||
pub struct AccountsIndexIterator<'a, T> {
|
||||
|
@ -1251,6 +1253,8 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
|||
uncleaned_roots_len,
|
||||
previous_uncleaned_roots_len,
|
||||
roots_range,
|
||||
rooted_cleaned_count: 0,
|
||||
unrooted_cleaned_count: 0,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Reference in New Issue