diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 1330f176f308bb..636ad3970b32ff 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -1763,11 +1763,14 @@ impl ClusterInfo { .map(|k| k.id) .chain(std::iter::once(self.id())) .collect(); + self.stats.trim_crds_table.add_relaxed(1); let mut gossip = self.gossip.write().unwrap(); match gossip.crds.trim(cap, &keep, stakes, timestamp()) { Err(err) => { self.stats.trim_crds_table_failed.add_relaxed(1); - error!("crds table trim failed: {:?}", err); + // TODO: Stakes are comming from the root-bank. Debug why/when + // they are empty/zero. + debug!("crds table trim failed: {:?}", err); } Ok(num_purged) => { self.stats diff --git a/gossip/src/cluster_info_metrics.rs b/gossip/src/cluster_info_metrics.rs index b0da4115590e75..0401b17a3786d3 100644 --- a/gossip/src/cluster_info_metrics.rs +++ b/gossip/src/cluster_info_metrics.rs @@ -115,6 +115,7 @@ pub(crate) struct GossipStats { pub(crate) skip_pull_response_shred_version: Counter, pub(crate) skip_pull_shred_version: Counter, pub(crate) skip_push_message_shred_version: Counter, + pub(crate) trim_crds_table: Counter, pub(crate) trim_crds_table_failed: Counter, pub(crate) trim_crds_table_purged_values_count: Counter, pub(crate) tvu_peers: Counter, @@ -398,6 +399,7 @@ pub(crate) fn submit_gossip_stats( stats.require_stake_for_gossip_unknown_stakes.clear(), i64 ), + ("trim_crds_table", stats.trim_crds_table.clear(), i64), ( "trim_crds_table_failed", stats.trim_crds_table_failed.clear(), diff --git a/gossip/src/crds.rs b/gossip/src/crds.rs index 13b3ed08e23344..fcba2230c681e7 100644 --- a/gossip/src/crds.rs +++ b/gossip/src/crds.rs @@ -533,7 +533,7 @@ impl Crds { stakes: &HashMap, now: u64, ) -> Result { - if stakes.is_empty() { + if stakes.values().all(|&stake| stake == 0) { return Err(CrdsError::UnknownStakes); } let mut keys: Vec<_> = self