Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
debug logs when crds table trim failed (#18307)
Browse files Browse the repository at this point in the history
reports of this error being possibly spammy:
https://discord.com/channels/428295358100013066/689412830075551748/859441080054710293

The commit changes the log level to debug.
Additionally adding a new metric to understand the frequency of this error.
  • Loading branch information
behzadnouri authored Jun 29, 2021
1 parent 9bd02c9 commit 9d983a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gossip/src/cluster_info_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/crds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl Crds {
stakes: &HashMap<Pubkey, u64>,
now: u64,
) -> Result</*num purged:*/ usize, CrdsError> {
if stakes.is_empty() {
if stakes.values().all(|&stake| stake == 0) {
return Err(CrdsError::UnknownStakes);
}
let mut keys: Vec<_> = self
Expand Down

0 comments on commit 9d983a3

Please sign in to comment.