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

fix(stages): calculate checkpoints from static files #6973

Merged
merged 1 commit into from
Mar 5, 2024
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
6 changes: 5 additions & 1 deletion crates/stages/src/stages/bodies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ fn stage_checkpoint<DB: Database>(
) -> ProviderResult<EntitiesCheckpoint> {
Ok(EntitiesCheckpoint {
processed: provider.count_entries::<tables::BlockBodyIndices>()? as u64,
total: (provider.count_entries::<tables::Headers>()? as u64).saturating_sub(1),
// Count only static files entries. If we count the database entries too, we may have
// duplicates. We're sure that the static files have all entries that database has,
// because we run the `StaticFileProducer` before starting the pipeline.
total: (provider.static_file_provider().count_entries::<tables::Headers>()? as u64)
.saturating_sub(1),
})
}

Expand Down
5 changes: 4 additions & 1 deletion crates/stages/src/stages/sender_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ fn stage_checkpoint<DB: Database>(
// matching the actual number of processed transactions. To fix that, we add the
// number of pruned `TransactionSenders` entries.
processed: provider.count_entries::<tables::TransactionSenders>()? as u64 + pruned_entries,
total: provider.count_entries::<tables::Transactions>()? as u64,
// Count only static files entries. If we count the database entries too, we may have
// duplicates. We're sure that the static files have all entries that database has,
// because we run the `StaticFileProducer` before starting the pipeline.
total: provider.static_file_provider().count_entries::<tables::Transactions>()? as u64,
})
}

Expand Down
5 changes: 4 additions & 1 deletion crates/stages/src/stages/tx_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ fn stage_checkpoint<DB: Database>(
// number of pruned `TransactionHashNumbers` entries.
processed: provider.count_entries::<tables::TransactionHashNumbers>()? as u64 +
pruned_entries,
total: provider.count_entries::<tables::Transactions>()? as u64,
// Count only static files entries. If we count the database entries too, we may have
// duplicates. We're sure that the static files have all entries that database has,
// because we run the `StaticFileProducer` before starting the pipeline.
total: provider.static_file_provider().count_entries::<tables::Transactions>()? as u64,
})
}

Expand Down
Loading