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

indexer: add warnings when FN returns unexpected results #10813

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions crates/sui-indexer/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub enum IndexerError {
#[error("Indexer failed to deserialize event from events table with error: `{0}`")]
EventDeserializationError(String),

#[error("Fullnode returns unexpected responses, which may block indexers from proceeding, with error: `{0}`")]
UnexpectedFullnodeResponseError(String),

#[error("Indexer failed to read fullnode with error: `{0}`")]
FullNodeReadingError(String),

Expand Down
18 changes: 18 additions & 0 deletions crates/sui-indexer/src/handlers/checkpoint_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ where
if let Ok(checkpoint) = download_result {
downloaded_checkpoints.push(checkpoint);
} else {
if let Err(IndexerError::UnexpectedFullnodeResponseError(fn_e)) =
download_result
{
warn!(
"Unexpected response from fullnode for object checkpoints: {}",
fn_e
);
}
break;
}
}
Expand All @@ -227,6 +235,7 @@ where
current_parallel_downloads =
std::cmp::min(downloaded_checkpoints.len() + 1, MAX_PARALLEL_DOWNLOADS);
if downloaded_checkpoints.is_empty() {
warn!("No object checkpoints downloaded, retrying in next iteration ...");
continue;
}

Expand Down Expand Up @@ -292,6 +301,14 @@ where
if let Ok(checkpoint) = download_result {
downloaded_checkpoints.push(checkpoint);
} else {
if let Err(IndexerError::UnexpectedFullnodeResponseError(fn_e)) =
download_result
{
warn!(
"Unexpected response from fullnode for checkpoints: {}",
fn_e
);
}
break;
}
}
Expand All @@ -303,6 +320,7 @@ where
current_parallel_downloads =
std::cmp::min(downloaded_checkpoints.len() + 1, MAX_PARALLEL_DOWNLOADS);
if downloaded_checkpoints.is_empty() {
warn!("No checkpoints downloaded, retrying in next iteration ...");
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions crates/sui-indexer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ pub async fn multi_get_full_transactions(
.map(CheckpointTransactionBlockResponse::try_from)
.collect::<Result<Vec<_>, _>>()
.map_err(|e| {
IndexerError::FullNodeReadingError(format!(
"Unexpected None value in SuiTransactionBlockFullResponse of digests {:?} with error {:?}",
digests, e
IndexerError::UnexpectedFullnodeResponseError(format!(
"Unexpected None value in SuiTransactionBlockFullResponse with error {:?}",
e
))
})?;
Ok(sui_full_transactions)
Expand Down