Unverified Commit 289c247f authored by asynchronous rob's avatar asynchronous rob Committed by GitHub
Browse files

Reduce signal channel sizes and more logging on approval-voting (#2751)

* reduce signal channel capacity

* more tracing for approval-voting
parent 702b518a
Pipeline #131445 failed with stages
in 17 minutes and 42 seconds
...@@ -495,9 +495,25 @@ async fn imported_block_info( ...@@ -495,9 +495,25 @@ async fn imported_block_info(
} }
}; };
tracing::trace!(
target: LOG_TARGET,
n_assignments = assignments.len(),
"Produced assignments"
);
let force_approve = let force_approve =
block_header.digest.convert_first(|l| match ConsensusLog::from_digest_item(l) { block_header.digest.convert_first(|l| match ConsensusLog::from_digest_item(l) {
Ok(Some(ConsensusLog::ForceApprove(num))) if num < block_header.number => Some(num), Ok(Some(ConsensusLog::ForceApprove(num))) if num < block_header.number => {
tracing::trace!(
target: LOG_TARGET,
?block_hash,
current_number = block_header.number,
approved_number = num,
"Force-approving based on header digest"
);
Some(num)
}
Ok(Some(_)) => None, Ok(Some(_)) => None,
Ok(None) => None, Ok(None) => None,
Err(err) => { Err(err) => {
...@@ -635,6 +651,12 @@ pub(crate) async fn handle_new_head( ...@@ -635,6 +651,12 @@ pub(crate) async fn handle_new_head(
imported_blocks_and_info imported_blocks_and_info
}; };
tracing::trace!(
target: LOG_TARGET,
imported_blocks = imported_blocks_and_info.len(),
"Inserting imported blocks into database"
);
for (block_hash, block_header, imported_block_info) in imported_blocks_and_info { for (block_hash, block_header, imported_block_info) in imported_blocks_and_info {
let ImportedBlockInfo { let ImportedBlockInfo {
included_candidates, included_candidates,
...@@ -708,10 +730,24 @@ pub(crate) async fn handle_new_head( ...@@ -708,10 +730,24 @@ pub(crate) async fn handle_new_head(
}; };
if let Some(up_to) = force_approve { if let Some(up_to) = force_approve {
tracing::debug!(
target: LOG_TARGET,
?block_hash,
up_to,
"Enacting force-approve",
);
approval_db::v1::force_approve(db_writer, block_hash, up_to) approval_db::v1::force_approve(db_writer, block_hash, up_to)
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?; .map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
} }
tracing::trace!(
target: LOG_TARGET,
?block_hash,
block_number = block_header.number,
"Writing BlockEntry",
);
let candidate_entries = approval_db::v1::add_block_entry( let candidate_entries = approval_db::v1::add_block_entry(
db_writer, db_writer,
block_entry, block_entry,
...@@ -747,6 +783,13 @@ pub(crate) async fn handle_new_head( ...@@ -747,6 +783,13 @@ pub(crate) async fn handle_new_head(
); );
} }
tracing::trace!(
target: LOG_TARGET,
head = ?head,
chain_length = approval_meta.len(),
"Informing distribution of newly imported chain",
);
ctx.send_message(ApprovalDistributionMessage::NewBlocks(approval_meta).into()).await; ctx.send_message(ApprovalDistributionMessage::NewBlocks(approval_meta).into()).await;
Ok(imported_candidates) Ok(imported_candidates)
......
...@@ -96,6 +96,9 @@ use polkadot_node_primitives::SpawnNamed; ...@@ -96,6 +96,9 @@ use polkadot_node_primitives::SpawnNamed;
// A capacity of bounded channels inside the overseer. // A capacity of bounded channels inside the overseer.
const CHANNEL_CAPACITY: usize = 1024; const CHANNEL_CAPACITY: usize = 1024;
// The capacity of signal channels to subsystems.
const SIGNAL_CHANNEL_CAPACITY: usize = 64;
// A graceful `Overseer` teardown time delay. // A graceful `Overseer` teardown time delay.
const STOP_DELAY: u64 = 1; const STOP_DELAY: u64 = 1;
// Target for logs. // Target for logs.
...@@ -2629,7 +2632,7 @@ fn spawn<S: SpawnNamed, M: Send + 'static>( ...@@ -2629,7 +2632,7 @@ fn spawn<S: SpawnNamed, M: Send + 'static>(
futures: &mut FuturesUnordered<BoxFuture<'static, SubsystemResult<()>>>, futures: &mut FuturesUnordered<BoxFuture<'static, SubsystemResult<()>>>,
task_kind: TaskKind, task_kind: TaskKind,
) -> SubsystemResult<OverseenSubsystem<M>> { ) -> SubsystemResult<OverseenSubsystem<M>> {
let (signal_tx, signal_rx) = metered::channel(CHANNEL_CAPACITY); let (signal_tx, signal_rx) = metered::channel(SIGNAL_CHANNEL_CAPACITY);
let ctx = OverseerSubsystemContext::new( let ctx = OverseerSubsystemContext::new(
signal_rx, signal_rx,
message_rx, message_rx,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment