Lower blockstore processor error severity (#15578)

This commit is contained in:
sakridge 2021-03-01 14:57:37 -08:00 committed by GitHub
parent 8c73187b1e
commit f1223fb783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 12 deletions

View File

@ -1019,11 +1019,19 @@ impl ReplayStage {
// that comes after the root, so we should not see any // that comes after the root, so we should not see any
// errors related to the slot being purged // errors related to the slot being purged
let slot = bank.slot(); let slot = bank.slot();
warn!("Fatal replay error in slot: {}, err: {:?}", slot, err);
let is_serious = matches!( // Block producer can abandon the block if it detects a better one
// while producing. Somewhat common and expected in a
// network with variable network/machine configuration.
let is_serious = !matches!(
err, err,
BlockstoreProcessorError::InvalidBlock(BlockError::InvalidTickCount) BlockstoreProcessorError::InvalidBlock(BlockError::TooFewTicks)
); );
if is_serious {
warn!("Fatal replay error in slot: {}, err: {:?}", slot, err);
} else {
info!("Slot had too few ticks: {}", slot);
}
Self::mark_dead_slot(blockstore, bank_progress, slot, &err, is_serious); Self::mark_dead_slot(blockstore, bank_progress, slot, &err, is_serious);
err err
})?; })?;
@ -2397,6 +2405,7 @@ pub(crate) mod tests {
#[test] #[test]
fn test_dead_fork_invalid_slot_tick_count() { fn test_dead_fork_invalid_slot_tick_count() {
solana_logger::setup();
// Too many ticks per slot // Too many ticks per slot
let res = check_dead_fork(|_keypair, bank| { let res = check_dead_fork(|_keypair, bank| {
let blockhash = bank.last_blockhash(); let blockhash = bank.last_blockhash();
@ -2412,7 +2421,7 @@ pub(crate) mod tests {
}); });
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res { if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::InvalidTickCount); assert_eq!(block_error, BlockError::TooManyTicks);
} else { } else {
panic!(); panic!();
} }
@ -2432,7 +2441,7 @@ pub(crate) mod tests {
}); });
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res { if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::InvalidTickCount); assert_eq!(block_error, BlockError::TooFewTicks);
} else { } else {
panic!(); panic!();
} }

View File

@ -2,7 +2,8 @@ use thiserror::Error;
#[derive(Error, Debug, PartialEq)] #[derive(Error, Debug, PartialEq)]
pub enum BlockError { pub enum BlockError {
/// Block did not have enough ticks or was not marked full /// Block did not have enough ticks was not marked full
/// and no shred with is_last was seen.
#[error("incomplete block")] #[error("incomplete block")]
Incomplete, Incomplete,
@ -14,9 +15,16 @@ pub enum BlockError {
#[error("invalid last tick")] #[error("invalid last tick")]
InvalidLastTick, InvalidLastTick,
/// Blocks can not have extra ticks or missing ticks /// Blocks can not have missing ticks
#[error("invalid tick count")] /// Usually indicates that the node was interruppted with a more valuable block during
InvalidTickCount, /// production and abandoned it for that more-favorable block. Leader sent data to indicate
/// the end of the block.
#[error("too few ticks")]
TooFewTicks,
/// Blocks can not have extra ticks
#[error("too many ticks")]
TooManyTicks,
/// All ticks must contain the same number of hashes within a block /// All ticks must contain the same number of hashes within a block
#[error("invalid tick hash count")] #[error("invalid tick hash count")]

View File

@ -545,12 +545,12 @@ pub fn verify_ticks(
if next_bank_tick_height > max_bank_tick_height { if next_bank_tick_height > max_bank_tick_height {
warn!("Too many entry ticks found in slot: {}", bank.slot()); warn!("Too many entry ticks found in slot: {}", bank.slot());
return Err(BlockError::InvalidTickCount); return Err(BlockError::TooManyTicks);
} }
if next_bank_tick_height < max_bank_tick_height && slot_full { if next_bank_tick_height < max_bank_tick_height && slot_full {
warn!("Too few entry ticks found in slot: {}", bank.slot()); info!("Too few entry ticks found in slot: {}", bank.slot());
return Err(BlockError::InvalidTickCount); return Err(BlockError::TooFewTicks);
} }
if next_bank_tick_height == max_bank_tick_height { if next_bank_tick_height == max_bank_tick_height {