populate ancient append vec metrics (#25204)

* populate ancient append vec metrics

* count ancient storages while enumerating storages anyway.
This commit is contained in:
Jeff Washington (jwash) 2022-05-13 18:20:15 -05:00 committed by GitHub
parent d7dcb62fe1
commit 9ccdc8a050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -5458,7 +5458,16 @@ impl AccountsDb {
) {
if let Some(sub_storages) = sub_storages {
stats.roots_older_than_epoch.fetch_add(1, Ordering::Relaxed);
let num_accounts = sub_storages.iter().map(|storage| storage.count()).sum();
let mut ancients = 0;
let num_accounts = sub_storages
.iter()
.map(|storage| {
if is_ancient(&storage.accounts) {
ancients += 1;
}
storage.count()
})
.sum();
let sizes = sub_storages
.iter()
.map(|storage| storage.total_bytes())
@ -5469,6 +5478,9 @@ impl AccountsDb {
stats
.accounts_in_roots_older_than_epoch
.fetch_add(num_accounts, Ordering::Relaxed);
stats
.ancient_append_vecs
.fetch_add(ancients, Ordering::Relaxed);
}
}