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

This commit is contained in:
Alexey Shekhirin
2024-03-05 19:20:44 +00:00
committed by GitHub
parent 33d01d3206
commit c8df172063
3 changed files with 13 additions and 3 deletions

View File

@@ -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),
})
}

View File

@@ -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,
})
}

View File

@@ -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,
})
}