From c91fbd289fd8c82588aec36419ac5a34db5ccfa6 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 1 Jun 2022 10:36:58 -0500 Subject: [PATCH] set active state to shrink_ancient when doing intersting work (#25677) --- runtime/src/accounts_db.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 019154769a..2648ff96bf 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -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());