Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,8 @@ pub(crate) struct ShrinkAncientStats {
pub(crate) many_ref_slots_skipped: AtomicU64,
pub(crate) slots_cannot_move_count: AtomicU64,
pub(crate) many_refs_old_alive: AtomicU64,
pub(crate) slots_eligible_to_shrink: AtomicU64,
pub(crate) total_dead_bytes: AtomicU64,
}

#[derive(Debug, Default)]
Expand Down Expand Up @@ -2239,6 +2241,16 @@ impl ShrinkAncientStats {
self.random_shrink.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"slots_eligible_to_shrink",
self.slots_eligible_to_shrink.swap(0, Ordering::Relaxed),
i64
),
(
"total_dead_bytes",
self.total_dead_bytes.swap(0, Ordering::Relaxed),
i64
),
(
"slots_considered",
self.slots_considered.swap(0, Ordering::Relaxed) as i64,
Expand Down
14 changes: 14 additions & 0 deletions accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,20 @@ impl AccountsDb {
}
}
}
let mut total_dead_bytes = 0;
let should_shrink_count = infos
.all_infos
.iter()
.filter(|info| info.should_shrink)
.map(|info| total_dead_bytes += info.capacity.saturating_sub(info.alive_bytes))
.count()
.saturating_sub(randoms as usize);
self.shrink_ancient_stats
.slots_eligible_to_shrink
.fetch_add(should_shrink_count as u64, Ordering::Relaxed);
self.shrink_ancient_stats
.total_dead_bytes
.fetch_add(total_dead_bytes, Ordering::Relaxed);
if randoms > 0 {
self.shrink_ancient_stats
.random_shrink
Expand Down