Better error for spurious cache misses. (#4669)

Happened on Kusama for some not yet known reason.
This commit is contained in:
Robert Klotzner
2022-01-07 11:23:20 +01:00
committed by GitHub
parent c805500dfb
commit 2f1643b430
2 changed files with 11 additions and 7 deletions
@@ -18,6 +18,7 @@
//! Error handling related code and Error/Result definitions.
use polkadot_node_network_protocol::request_response::outgoing::RequestError;
use polkadot_primitives::v1::SessionIndex;
use thiserror::Error;
use futures::channel::oneshot;
@@ -76,8 +77,8 @@ pub enum NonFatal {
QueryAvailableDataResponseChannel(#[source] oneshot::Canceled),
/// We tried accessing a session that was not cached.
#[error("Session is not cached.")]
NoSuchCachedSession,
#[error("Session {missing_session} is not cached, cached sessions: {available_sessions:?}.")]
NoSuchCachedSession { available_sessions: Vec<SessionIndex>, missing_session: SessionIndex },
/// Sending request response failed (Can happen on timeouts for example).
#[error("Sending a request's response failed.")]
@@ -120,7 +121,7 @@ pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<(
match error {
NonFatal::UnexpectedPoV |
NonFatal::InvalidValidatorIndex |
NonFatal::NoSuchCachedSession |
NonFatal::NoSuchCachedSession { .. } |
NonFatal::QueryAvailableDataResponseChannel(_) |
NonFatal::QueryChunkResponseChannel(_) =>
tracing::warn!(target: LOG_TARGET, error = %error, ctx),