fix: adapt to #20508 API and add const to stub functions

- Remove non-existent check_file_consistency() call
- Simplify ordering: static file check first, then RocksDB check
- Add const to first() and last() stub functions
This commit is contained in:
yongkangc
2025-12-23 04:20:34 +00:00
parent 8a7a0f2f16
commit a2fec130f6
2 changed files with 9 additions and 18 deletions

View File

@@ -506,22 +506,9 @@ where
// inconsistencies are found, unwind to the first block that's consistent across all
// storage layers.
//
// The ordering is critical:
// 1. Static file consistency (file-level) - heals interrupted writes without pruning data
// 2. RocksDB consistency - needs static file data to compute tx hashes for pruning
// 3. Static file consistency (checkpoint-level) - compares with MDBX, may prune data
//
// We compute a combined unwind target from checks and run a single unwind pass.
// Step 1: Heal any file-level inconsistencies (interrupted writes, partial commits)
// This does NOT prune data, so RocksDB can still access transaction data.
factory.static_file_provider().check_file_consistency()?;
// Step 2: RocksDB consistency check - uses static file data for tx hash lookups
let rocksdb_unwind =
factory.rocksdb_provider().check_consistency(&factory.database_provider_ro()?)?;
// Step 3: Static file checkpoint consistency - compares with MDBX, may prune data
// Static file check runs first since it heals file-level inconsistencies and RocksDB
// consistency check may depend on static file data for tx hash lookups.
// We compute a combined unwind target from both checks and run a single unwind pass.
let static_file_unwind = factory
.static_file_provider()
.check_consistency(&factory.provider()?)?
@@ -530,6 +517,10 @@ where
PipelineTarget::Sync(_) => unreachable!("check_consistency returns Unwind"),
});
// RocksDB consistency check
let rocksdb_unwind =
factory.rocksdb_provider().check_consistency(&factory.database_provider_ro()?)?;
// Combine unwind targets - take the minimum (most conservative) if both exist
let unwind_target = match (static_file_unwind, rocksdb_unwind) {
(None, None) => None,

View File

@@ -86,12 +86,12 @@ impl RocksDBProvider {
}
/// Gets the first key-value pair from a table (stub implementation).
pub fn first<T: Table>(&self) -> ProviderResult<Option<(T::Key, T::Value)>> {
pub const fn first<T: Table>(&self) -> ProviderResult<Option<(T::Key, T::Value)>> {
Ok(None)
}
/// Gets the last key-value pair from a table (stub implementation).
pub fn last<T: Table>(&self) -> ProviderResult<Option<(T::Key, T::Value)>> {
pub const fn last<T: Table>(&self) -> ProviderResult<Option<(T::Key, T::Value)>> {
Ok(None)
}