diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 0b17c0972f1c43..9fa904c266ce3e 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -1956,6 +1956,7 @@ pub(crate) struct ShrinkAncientStats { pub(crate) bytes_ancient_created: AtomicU64, pub(crate) bytes_from_must_shrink: AtomicU64, pub(crate) bytes_from_smallest_storages: AtomicU64, + pub(crate) bytes_from_newest_storages: AtomicU64, pub(crate) many_ref_slots_skipped: AtomicU64, pub(crate) slots_cannot_move_count: AtomicU64, pub(crate) many_refs_old_alive: AtomicU64, @@ -2258,6 +2259,11 @@ impl ShrinkAncientStats { self.bytes_from_smallest_storages.swap(0, Ordering::Relaxed) as i64, i64 ), + ( + "bytes_from_newest_storages", + self.bytes_from_newest_storages.swap(0, Ordering::Relaxed) as i64, + i64 + ), ( "many_ref_slots_skipped", self.many_ref_slots_skipped.swap(0, Ordering::Relaxed), diff --git a/accounts-db/src/ancient_append_vecs.rs b/accounts-db/src/ancient_append_vecs.rs index aa700557350fc1..f00bbc7ac51140 100644 --- a/accounts-db/src/ancient_append_vecs.rs +++ b/accounts-db/src/ancient_append_vecs.rs @@ -210,6 +210,7 @@ impl AncientSlotInfos { let low_threshold = tuning.max_ancient_slots * 50 / 100; let mut bytes_from_must_shrink = 0; let mut bytes_from_smallest_storages = 0; + let mut bytes_from_newest_storages = 0; for (i, info) in self.all_infos.iter().enumerate() { cumulative_bytes += info.alive_bytes; let ancient_storages_required = @@ -235,6 +236,8 @@ impl AncientSlotInfos { } if info.should_shrink { bytes_from_must_shrink += info.alive_bytes; + } if info.is_high_slot { + bytes_from_newest_storages += info.alive_bytes; } else { bytes_from_smallest_storages += info.alive_bytes; } @@ -245,6 +248,9 @@ impl AncientSlotInfos { stats .bytes_from_smallest_storages .fetch_add(bytes_from_smallest_storages, Ordering::Relaxed); + stats + .bytes_from_newest_storages + .fetch_add(bytes_from_newest_storages, Ordering::Relaxed); } /// remove entries from 'all_infos' such that combining