-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
C-enhancementNew feature or requestNew feature or requestS-needs-triageThis issue needs to be labelledThis issue needs to be labelled
Description
Describe the feature
Right now we make sure that static files have been properly committed, and in the right order, by using check_consistency and ensure_invariants:
reth/crates/storage/provider/src/providers/static_file/manager.rs
Lines 991 to 1025 in 179e164
| /// Ensures that any broken invariants which cannot be healed on the spot return a pipeline | |
| /// target to unwind to. | |
| /// | |
| /// Two types of consistency checks are done for: | |
| /// | |
| /// 1) When a static file fails to commit but the underlying data was changed. | |
| /// 2) When a static file was committed, but the required database transaction was not. | |
| /// | |
| /// For 1) it can self-heal if `self.access.is_read_only()` is set to `false`. Otherwise, it | |
| /// will return an error. | |
| /// For 2) the invariants below are checked, and if broken, might require a pipeline unwind | |
| /// to heal. | |
| /// | |
| /// For each static file segment: | |
| /// * the corresponding database table should overlap or have continuity in their keys | |
| /// ([`TxNumber`] or [`BlockNumber`]). | |
| /// * its highest block should match the stage checkpoint block number if it's equal or higher | |
| /// than the corresponding database table last entry. | |
| /// | |
| /// Returns a [`Option`] of [`PipelineTarget::Unwind`] if any healing is further required. | |
| /// | |
| /// WARNING: No static file writer should be held before calling this function, otherwise it | |
| /// will deadlock. | |
| pub fn check_consistency<Provider>( | |
| &self, | |
| provider: &Provider, | |
| ) -> ProviderResult<Option<PipelineTarget>> | |
| where | |
| Provider: DBProvider | |
| + BlockReader | |
| + StageCheckpointReader | |
| + ChainSpecProvider | |
| + StorageSettingsCache, | |
| N: NodePrimitives<Receipt: Value, BlockHeader: Value, SignedTx: Value>, | |
| { |
| fn ensure_invariants<Provider, T: Table<Key = u64>>( |
We should add a version of this for tables that we've moved to RocksDB
Additional context
No response
Metadata
Metadata
Assignees
Labels
C-enhancementNew feature or requestNew feature or requestS-needs-triageThis issue needs to be labelledThis issue needs to be labelled
Type
Projects
Status
Backlog