Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sui-core] Better consensus adaptor logs #3663

Merged
merged 3 commits into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions crates/sui-core/src/consensus_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use sui_types::{
error::{SuiError, SuiResult},
messages::ConsensusTransaction,
};
use tap::prelude::*;
use tokio::{
sync::{
mpsc::{Receiver, Sender},
Expand All @@ -33,6 +34,7 @@ use tokio::{
time::{timeout, Duration},
};
use tracing::debug;
use tracing::log::error;

#[cfg(test)]
#[path = "unit_tests/consensus_tests.rs"]
Expand Down Expand Up @@ -170,7 +172,10 @@ impl ConsensusAdapter {
.clone()
.submit_transaction(TransactionProto { transaction: bytes })
.await
.map_err(|e| SuiError::ConsensusConnectionBroken(format!("{:?}", e)))?;
.map_err(|e| SuiError::ConsensusConnectionBroken(format!("{:?}", e)))
.tap_err(|r| {
error!("Submit transaction failed with: {:?}", r);
})?;
}

// Wait for the consensus to sequence the certificate and assign locks to shared objects.
Expand Down Expand Up @@ -427,7 +432,8 @@ impl CheckpointConsensusAdapter {
let future = Self::waiter(waiter, self.retry_delay, deliver);
waiting.push(future);
}
Err(_) => {
Err(e) => {
error!("Checkpoint fragment submit failed: {:?}", e);
self.buffer.push_back((serialized, sequence_number));
break;
}
Expand All @@ -452,14 +458,14 @@ impl CheckpointConsensusAdapter {
// Add the fragment to the buffer.
let transaction = ConsensusTransaction::Checkpoint(Box::new(fragment));
let serialized = bincode::serialize(&transaction)
.expect("Failed to serialize consensus tx");
.expect("Failed to serialize checkpoint fragment");
self.buffer.push_front((serialized, sequence_number));
},

// Listen to checkpoint fragments who failed to be sequenced and need retries.
Some((outcome, identifier)) = waiting.next() => {
if let Err(error) = outcome {
tracing::debug!("Failed to sequence transaction: {error}");
tracing::debug!("Failed to sequence checkpoint fragment: {error}");
let (serialized_transaction, checkpoint_sequence_number) = identifier;
self.buffer.push_back((serialized_transaction, checkpoint_sequence_number));
}
Expand Down