Unverified Commit cd9929fb authored by Lldenaurois's avatar Lldenaurois Committed by GitHub
Browse files

Replicate Rob's PR (#4337)

parent 58e4ef8e
Pipeline #167088 passed with stages
in 44 minutes and 20 seconds
...@@ -932,6 +932,13 @@ impl CandidateBackingJob { ...@@ -932,6 +932,13 @@ impl CandidateBackingJob {
// Sanity check that candidate is from our assignment. // Sanity check that candidate is from our assignment.
if Some(candidate.descriptor().para_id) != self.assignment { if Some(candidate.descriptor().para_id) != self.assignment {
tracing::debug!(
target: LOG_TARGET,
our_assignment = ?self.assignment,
collation = ?candidate.descriptor().para_id,
"Subsystem asked to second for para outside of our assignment",
);
return Ok(()) return Ok(())
} }
......
...@@ -649,6 +649,9 @@ impl Initialized { ...@@ -649,6 +649,9 @@ impl Initialized {
}, },
}; };
let candidate_receipt = votes.candidate_receipt.clone(); let candidate_receipt = votes.candidate_receipt.clone();
let was_concluded_valid = votes.valid.len() >= supermajority_threshold;
let was_concluded_invalid = votes.invalid.len() >= supermajority_threshold;
let mut recent_disputes = overlay_db.load_recent_disputes()?.unwrap_or_default(); let mut recent_disputes = overlay_db.load_recent_disputes()?.unwrap_or_default();
let controlled_indices = find_controlled_validator_indices(&self.keystore, &validators); let controlled_indices = find_controlled_validator_indices(&self.keystore, &validators);
...@@ -813,10 +816,11 @@ impl Initialized { ...@@ -813,10 +816,11 @@ impl Initialized {
self.metrics.on_open(); self.metrics.on_open();
} }
if concluded_valid { if !was_concluded_valid && concluded_valid {
self.metrics.on_concluded_valid(); self.metrics.on_concluded_valid();
} }
if concluded_invalid {
if !was_concluded_invalid && concluded_invalid {
self.metrics.on_concluded_invalid(); self.metrics.on_concluded_invalid();
} }
......
...@@ -58,16 +58,6 @@ pub struct SendTask { ...@@ -58,16 +58,6 @@ pub struct SendTask {
/// Whether we have any tasks failed since the last refresh. /// Whether we have any tasks failed since the last refresh.
has_failed_sends: bool, has_failed_sends: bool,
/// Total count of failed transmissions.
///
/// Used for issuing a warning, if that number gets above a certain threshold.
failed_count: usize,
/// Total number of initiated requests.
///
/// Used together with `failed_count` for issuing a warning on too many failed attempts.
send_count: usize,
/// Sender to be cloned for tasks. /// Sender to be cloned for tasks.
tx: mpsc::Sender<TaskFinish>, tx: mpsc::Sender<TaskFinish>,
} }
...@@ -120,14 +110,8 @@ impl SendTask { ...@@ -120,14 +110,8 @@ impl SendTask {
request: DisputeRequest, request: DisputeRequest,
metrics: &Metrics, metrics: &Metrics,
) -> Result<Self> { ) -> Result<Self> {
let mut send_task = Self { let mut send_task =
request, Self { request, deliveries: HashMap::new(), has_failed_sends: false, tx };
deliveries: HashMap::new(),
has_failed_sends: false,
tx,
failed_count: 0,
send_count: 0,
};
send_task.refresh_sends(ctx, runtime, active_sessions, metrics).await?; send_task.refresh_sends(ctx, runtime, active_sessions, metrics).await?;
Ok(send_task) Ok(send_task)
} }
...@@ -160,7 +144,6 @@ impl SendTask { ...@@ -160,7 +144,6 @@ impl SendTask {
.await?; .await?;
self.has_failed_sends = false; self.has_failed_sends = false;
self.send_count += new_statuses.len();
self.deliveries.extend(new_statuses.into_iter()); self.deliveries.extend(new_statuses.into_iter());
Ok(()) Ok(())
} }
...@@ -176,7 +159,7 @@ impl SendTask { ...@@ -176,7 +159,7 @@ impl SendTask {
pub fn on_finished_send(&mut self, authority: &AuthorityDiscoveryId, result: TaskResult) { pub fn on_finished_send(&mut self, authority: &AuthorityDiscoveryId, result: TaskResult) {
match result { match result {
TaskResult::Failed(err) => { TaskResult::Failed(err) => {
tracing::debug!( tracing::trace!(
target: LOG_TARGET, target: LOG_TARGET,
?authority, ?authority,
candidate_hash = %self.request.0.candidate_receipt.hash(), candidate_hash = %self.request.0.candidate_receipt.hash(),
...@@ -184,25 +167,6 @@ impl SendTask { ...@@ -184,25 +167,6 @@ impl SendTask {
"Error sending dispute statements to node." "Error sending dispute statements to node."
); );
self.failed_count += 1;
let error_rate = (100 * self.failed_count).checked_div(self.send_count).expect(
"We cannot receive a failed request, without having sent one first. qed.",
);
// 10% seems to be a sensible threshold to become alert - note that
// self.send_count gets increased in batches of the full validator set, so we don't
// need to account for a low send_count.
if error_rate > 10 {
tracing::warn!(
target: LOG_TARGET,
candidate_hash = %self.request.0.candidate_receipt.hash(),
last_authority = ?authority,
last_error = %err,
failed_count = ?self.failed_count,
total_attempts = ?self.send_count,
"Sending our dispute vote failed for more than 10% of total attempts!"
);
}
self.has_failed_sends = true; self.has_failed_sends = true;
// Remove state, so we know what to try again: // Remove state, so we know what to try again:
self.deliveries.remove(authority); self.deliveries.remove(authority);
......
Markdown is supported
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