Skip to content

Commit

Permalink
make prospective-parachains debug logs less spammy (#6406)
Browse files Browse the repository at this point in the history
Fixes #6172
  • Loading branch information
alindima authored Nov 7, 2024
1 parent 8795ae6 commit 2680f20
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
47 changes: 30 additions & 17 deletions polkadot/node/core/prospective-parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ async fn handle_introduce_seconded_candidate(
},
};

let mut added = false;
let mut added = Vec::with_capacity(view.per_relay_parent.len());
let mut para_scheduled = false;
// We don't iterate only through the active leaves. We also update the deactivated parents in
// the implicit view, so that their upcoming children may see these candidates.
Expand All @@ -536,29 +536,21 @@ async fn handle_introduce_seconded_candidate(

match chain.try_adding_seconded_candidate(&candidate_entry) {
Ok(()) => {
gum::debug!(
target: LOG_TARGET,
?para,
?relay_parent,
?is_active_leaf,
"Added seconded candidate {:?}",
candidate_hash
);
added = true;
added.push(*relay_parent);
},
Err(FragmentChainError::CandidateAlreadyKnown) => {
gum::debug!(
gum::trace!(
target: LOG_TARGET,
?para,
?relay_parent,
?is_active_leaf,
"Attempting to introduce an already known candidate: {:?}",
candidate_hash
);
added = true;
added.push(*relay_parent);
},
Err(err) => {
gum::debug!(
gum::trace!(
target: LOG_TARGET,
?para,
?relay_parent,
Expand All @@ -580,16 +572,24 @@ async fn handle_introduce_seconded_candidate(
);
}

if !added {
if added.is_empty() {
gum::debug!(
target: LOG_TARGET,
para = ?para,
candidate = ?candidate_hash,
"Newly-seconded candidate cannot be kept under any relay parent",
);
} else {
gum::debug!(
target: LOG_TARGET,
?para,
"Added/Kept seconded candidate {:?} on relay parents: {:?}",
candidate_hash,
added
);
}

let _ = tx.send(added);
let _ = tx.send(!added.is_empty());
}

async fn handle_candidate_backed(
Expand Down Expand Up @@ -779,19 +779,32 @@ fn answer_hypothetical_membership_request(
membership.push(*active_leaf);
},
Err(err) => {
gum::debug!(
gum::trace!(
target: LOG_TARGET,
para = ?para_id,
leaf = ?active_leaf,
candidate = ?candidate.candidate_hash(),
"Candidate is not a hypothetical member: {}",
"Candidate is not a hypothetical member on: {}",
err
)
},
};
}
}

for (candidate, membership) in &response {
if membership.is_empty() {
gum::debug!(
target: LOG_TARGET,
para = ?candidate.candidate_para(),
active_leaves = ?view.active_leaves,
?required_active_leaf,
candidate = ?candidate.candidate_hash(),
"Candidate is not a hypothetical member on any of the active leaves",
)
}
}

let _ = tx.send(response);
}

Expand Down
9 changes: 9 additions & 0 deletions prdoc/pr_6406.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: 'make prospective-parachains debug logs less spammy'
doc:
- audience: [Node Dev, Node Operator]
description: |
Demote some of the frequent prospective-parachains debug logs to trace level and prefer printing aggregate debug logs.

crates:
- name: polkadot-node-core-prospective-parachains
bump: patch

0 comments on commit 2680f20

Please sign in to comment.