Skip to content

Conversation

@sistemd
Copy link
Contributor

@sistemd sistemd commented Dec 22, 2025

If an error occurs while downloading an OF1 CAR file, the next time the extractor runs should resume the file download. This commit adds that logic.

This bug was discovered while testing Solana full sync.

@sistemd sistemd requested a review from leoyvens December 22, 2025 11:31
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Comment on lines 220 to 260
match num_retries {
0 => {
// First error, make sure it is visible in info (default) logs.
num_retries += 1;
tracing::info!(block = %current_block, error = %e, "Block streaming failed, retrying");
tokio::time::sleep(DEBUG_RETRY_DELAY).await;
}
1..DEBUG_RETRY_LIMIT => {
num_retries += 1;
tracing::debug!(block = %current_block, error = %e, "Block streaming failed, retrying");
tokio::time::sleep(DEBUG_RETRY_DELAY).await;
}
DEBUG_RETRY_LIMIT..WARN_RETRY_LIMIT => {
num_retries += 1;
tracing::warn!(block = %current_block, error = %e, "Block streaming failed, retrying");
tokio::time::sleep(WARN_RETRY_DELAY).await;
}
_ => {
tracing::error!(block = %current_block, error = %e, "Block streaming failed, retrying");
tokio::time::sleep(ERROR_RETRY_DELAY).await;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the logs, next to the error field, I would add the error_source = logging::error_source(&e) for more context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let start = std::time::Instant::now();
let response = reqwest::get(&car_file_url).await?;
let status = response.status();
let action = match std::fs::metadata(dest).map(|meta| meta.len()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using fs_err instead of std::fs. It has superior error reporting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- If an error occurs while downloading an OF1 CAR file, the next time
the extractor runs should resume the file download. This commit adds
that logic.
@sistemd sistemd force-pushed the sistemd/solana-handle-partial-of1-downloads branch from ebb2f14 to 902c3c0 Compare December 24, 2025 13:37
@sistemd sistemd merged commit 62e28bb into main Dec 24, 2025
8 checks passed
@sistemd sistemd deleted the sistemd/solana-handle-partial-of1-downloads branch December 24, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants