Skip to content

Commit

Permalink
downgrading error!() to warn!() where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos committed Dec 18, 2024
1 parent dd0dcd2 commit cbcebaf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 16 additions & 3 deletions consensus/src/liveness/leader_reputation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ use std::{
cmp::max,
collections::{HashMap, HashSet},
convert::TryFrom,
sync::Arc,
sync::{atomic::AtomicU64, Arc},
};

const U32_MASK: u64 = u32::MAX as u64;

pub type VotingPowerRatio = f64;

/// Interface to query committed NewBlockEvent.
Expand All @@ -56,6 +58,7 @@ pub struct AptosDBBackend {
seek_len: usize,
aptos_db: Arc<dyn DbReader>,
db_result: Mutex<Option<(Vec<VersionedNewBlockEvent>, u64, bool)>>,
max_asked: AtomicU64,
}

impl AptosDBBackend {
Expand All @@ -65,6 +68,7 @@ impl AptosDBBackend {
seek_len,
aptos_db,
db_result: Mutex::new(None),
max_asked: AtomicU64::new(0),
}
}

Expand Down Expand Up @@ -108,6 +112,11 @@ impl AptosDBBackend {
events: &Vec<VersionedNewBlockEvent>,
hit_end: bool,
) -> (Vec<NewBlockEvent>, HashValue) {
let previous_max_asked = self.max_asked.fetch_max(
(target_epoch & U32_MASK) << 32 | (target_round & U32_MASK),
std::sync::atomic::Ordering::Relaxed,
);

// Do not warn when round==0, because check will always be unsure of whether we have
// all events from the previous epoch. If there is an actual issue, next round will log it.
if target_round != 0 {
Expand Down Expand Up @@ -135,15 +144,19 @@ impl AptosDBBackend {
}

if result.len() < self.window_size && !hit_end {
error!(
"We are not fetching far enough in history, we filtered from {} to {}, but asked for {}. Target ({}, {}), received from {:?} to {:?}.",
let previous_max_asked_epoch = previous_max_asked >> 32;
let previous_max_asked_round = previous_max_asked & U32_MASK;
warn!(
"We are not fetching far enough in history, we filtered from {} to {}, but asked for {}. Target ({}, {}), received from {:?} to {:?}. We are probably asked for too stale of a round, previous max asked: ({}, {}).",
events.len(),
result.len(),
self.window_size,
target_epoch,
target_round,
events.last().map_or((0, 0), |e| (e.event.epoch(), e.event.round())),
events.first().map_or((0, 0), |e| (e.event.epoch(), e.event.round())),
previous_max_asked_epoch,
previous_max_asked_round,
);
}

Expand Down
6 changes: 3 additions & 3 deletions consensus/src/pipeline/buffer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ impl BufferManager {
let signature = match signature_result {
Ok(sig) => sig,
Err(e) => {
error!("Signing failed {:?}", e);
warn!("error: Signing failed {:?}", e);
return;
},
};
Expand Down Expand Up @@ -792,11 +792,11 @@ impl BufferManager {
item.try_advance_to_aggregated(&self.epoch_state.verifier)
},
Err(e) => {
error!(
warn!(
error = ?e,
author = author,
commit_info = commit_info,
"Failed to add commit vote",
"error: Failed to add commit vote",
);
reply_nack(protocol, response_sender);
item
Expand Down

0 comments on commit cbcebaf

Please sign in to comment.