set active state to shrink_ancient when doing intersting work (#25677)

This commit is contained in:
Jeff Washington (jwash) 2022-06-01 10:36:58 -05:00 committed by GitHub
parent 8bb76fcd87
commit c91fbd289f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -3555,7 +3555,7 @@ impl AccountsDb {
if sorted_slots.is_empty() {
return;
}
let _guard = self.active_stats.activate(ActiveStatItem::SquashAncient);
let mut guard = None;
// the ancient append vec currently being written to
let mut current_ancient = None;
@ -3579,6 +3579,11 @@ impl AccountsDb {
}
};
if guard.is_none() {
// we are now doing interesting work in squashing ancient
guard = Some(self.active_stats.activate(ActiveStatItem::SquashAncient))
}
// this code is copied from shrink. I would like to combine it into a helper function, but the borrow checker has defeated my efforts so far.
let (stored_accounts, _num_stores, original_bytes) =
self.get_unique_accounts_from_storages(old_storages.iter());