From dc0429f5e6de0bebf9a166889616b4a291356351 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Thu, 6 May 2021 15:04:13 -0500 Subject: [PATCH] add metric for assumption (#17061) --- runtime/src/accounts_index.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 78f933fe21..f761af39c9 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -5,6 +5,7 @@ use crate::{ }; use bv::BitVec; use dashmap::DashSet; +use log::*; use ouroboros::self_referencing; use solana_measure::measure::Measure; use solana_sdk::{ @@ -1315,11 +1316,27 @@ impl AccountsIndex { pub fn clean_dead_slot(&self, slot: Slot) -> Option { let (roots_len, uncleaned_roots_len, previous_uncleaned_roots_len, roots_range) = { let mut w_roots_tracker = self.roots_tracker.write().unwrap(); + let removed_from_unclean_roots = w_roots_tracker.uncleaned_roots.remove(&slot); + let removed_from_previous_uncleaned_roots = + w_roots_tracker.previous_uncleaned_roots.remove(&slot); if !w_roots_tracker.roots.remove(&slot) { + if removed_from_unclean_roots { + error!("clean_dead_slot-removed_from_unclean_roots: {}", slot); + inc_new_counter_error!("clean_dead_slot-removed_from_unclean_roots", 1, 1); + } + if removed_from_previous_uncleaned_roots { + error!( + "clean_dead_slot-removed_from_previous_uncleaned_roots: {}", + slot + ); + inc_new_counter_error!( + "clean_dead_slot-removed_from_previous_uncleaned_roots", + 1, + 1 + ); + } return None; } - w_roots_tracker.uncleaned_roots.remove(&slot); - w_roots_tracker.previous_uncleaned_roots.remove(&slot); ( w_roots_tracker.roots.len(), w_roots_tracker.uncleaned_roots.len(), @@ -1414,7 +1431,6 @@ impl AccountsIndex { #[cfg(test)] pub mod tests { use super::*; - use log::*; use solana_sdk::signature::{Keypair, Signer}; pub enum SecondaryIndexTypes<'a> {