mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
yet another set of logging improvements (#2638)
This commit is contained in:
committed by
GitHub
parent
04f04ea6db
commit
cd2b745b28
@@ -827,10 +827,24 @@ async fn handle_approved_ancestor(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Some(a_entry) => {
|
Some(a_entry) => {
|
||||||
let our_assignment = a_entry.our_assignment();
|
match a_entry.our_assignment() {
|
||||||
|
None => tracing::debug!(
|
||||||
|
target: LOG_TARGET,
|
||||||
|
?candidate_hash,
|
||||||
|
?block_hash,
|
||||||
|
"no assignment."
|
||||||
|
),
|
||||||
|
Some(a) => {
|
||||||
|
let tranche = a.tranche();
|
||||||
|
let triggered = a.triggered();
|
||||||
|
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
?our_assignment,
|
?candidate_hash,
|
||||||
|
?block_hash,
|
||||||
|
tranche,
|
||||||
|
triggered,
|
||||||
|
"assigned"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -839,6 +853,8 @@ async fn handle_approved_ancestor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ use polkadot_node_subsystem_util::{
|
|||||||
JobTrait, FromJobCommand, Validator, metrics::{self, prometheus},
|
JobTrait, FromJobCommand, Validator, metrics::{self, prometheus},
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
CandidateReceipt, CollatorId, CoreState, CoreIndex, Hash, Id as ParaId, PoV,
|
CandidateReceipt, CollatorId, CoreState, CoreIndex, Hash, Id as ParaId, PoV, BlockNumber,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::SignedFullStatement;
|
use polkadot_node_primitives::SignedFullStatement;
|
||||||
use std::{pin::Pin, sync::Arc};
|
use std::{pin::Pin, sync::Arc};
|
||||||
@@ -139,30 +139,47 @@ impl JobTrait for CandidateSelectionJob {
|
|||||||
.with_stage(jaeger::Stage::CandidateSelection)
|
.with_stage(jaeger::Stage::CandidateSelection)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut assignment = None;
|
#[derive(Debug)]
|
||||||
|
enum AssignmentState {
|
||||||
|
Unassigned,
|
||||||
|
Scheduled(ParaId),
|
||||||
|
Occupied(BlockNumber),
|
||||||
|
Free,
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut assignment = AssignmentState::Unassigned;
|
||||||
|
|
||||||
for (idx, core) in cores.into_iter().enumerate() {
|
for (idx, core) in cores.into_iter().enumerate() {
|
||||||
// Ignore prospective assignments on occupied cores for the time being.
|
|
||||||
if let CoreState::Scheduled(scheduled) = core {
|
|
||||||
let core_index = CoreIndex(idx as _);
|
let core_index = CoreIndex(idx as _);
|
||||||
let group_index = group_rotation_info.group_for_core(core_index, n_cores);
|
let group_index = group_rotation_info.group_for_core(core_index, n_cores);
|
||||||
if let Some(g) = validator_groups.get(group_index.0 as usize) {
|
if let Some(g) = validator_groups.get(group_index.0 as usize) {
|
||||||
if g.contains(&validator.index()) {
|
if g.contains(&validator.index()) {
|
||||||
assignment = Some(scheduled.para_id);
|
match core {
|
||||||
break;
|
CoreState::Scheduled(scheduled) => {
|
||||||
|
assignment = AssignmentState::Scheduled(scheduled.para_id);
|
||||||
}
|
}
|
||||||
|
CoreState::Occupied(occupied) => {
|
||||||
|
// Ignore prospective assignments on occupied cores
|
||||||
|
// for the time being.
|
||||||
|
assignment = AssignmentState::Occupied(occupied.occupied_since);
|
||||||
|
}
|
||||||
|
CoreState::Free => {
|
||||||
|
assignment = AssignmentState::Free;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let assignment = match assignment {
|
let assignment = match assignment {
|
||||||
Some(assignment) => {
|
AssignmentState::Scheduled(assignment) => {
|
||||||
assignment_span.add_string_tag("assigned", "true");
|
assignment_span.add_string_tag("assigned", "true");
|
||||||
assignment_span.add_para_id(assignment);
|
assignment_span.add_para_id(assignment);
|
||||||
|
|
||||||
assignment
|
assignment
|
||||||
}
|
}
|
||||||
None => {
|
assignment => {
|
||||||
assignment_span.add_string_tag("assigned", "false");
|
assignment_span.add_string_tag("assigned", "false");
|
||||||
|
|
||||||
let validator_index = validator.index();
|
let validator_index = validator.index();
|
||||||
@@ -173,6 +190,7 @@ impl JobTrait for CandidateSelectionJob {
|
|||||||
?relay_parent,
|
?relay_parent,
|
||||||
?validator_index,
|
?validator_index,
|
||||||
?validator_id,
|
?validator_id,
|
||||||
|
?assignment,
|
||||||
"No assignment. Will not select candidate."
|
"No assignment. Will not select candidate."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user