Skip to content

feat(storage): add method to check invariants on RocksDB tables#20340

Merged
fgimenez merged 9 commits intomainfrom
fgimenez/rocksdb-table-invariants
Dec 17, 2025
Merged

feat(storage): add method to check invariants on RocksDB tables#20340
fgimenez merged 9 commits intomainfrom
fgimenez/rocksdb-table-invariants

Conversation

@fgimenez
Copy link
Member

@fgimenez fgimenez commented Dec 12, 2025

Closes #20153

Adds invariant checking for RocksDB tables, similar to the existing check_consistency and ensure_invariants methods for static files.

  • Add first() and last() methods to RocksDBProvider for efficient table bounds checking
  • Add check_consistency() method that validates RocksDB tables against MDBX stage checkpoints
  • For TransactionHashNumbers: maps max tx_number -> block_number via TransactionBlocks to detect if RocksDB is behind the TransactionLookup checkpoint
  • For StoragesHistory: checks if table is empty when IndexStorageHistory checkpoint indicates data should exist
  • Returns an unwind target block number when inconsistencies are detected

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Dec 12, 2025
@github-actions github-actions bot added the C-enhancement New feature or request label Dec 12, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 12, 2025

CodSpeed Performance Report

Merging #20340 will not alter performance

Comparing fgimenez/rocksdb-table-invariants (ac1cd59) with main (c65df40)

Summary

✅ 110 untouched
⏩ 7 skipped1

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Base automatically changed from feat/either-reader-rocksdb to main December 13, 2025 04:17
@fgimenez fgimenez force-pushed the fgimenez/rocksdb-table-invariants branch 2 times, most recently from da863a7 to 0c2d74a Compare December 15, 2025 10:42
@fgimenez fgimenez marked this pull request as ready for review December 15, 2025 10:42
@yongkangc yongkangc self-requested a review December 15, 2025 11:32
@fgimenez fgimenez force-pushed the fgimenez/rocksdb-table-invariants branch from 0c2d74a to 2b71528 Compare December 16, 2025 10:04
@fgimenez fgimenez force-pushed the fgimenez/rocksdb-table-invariants branch from 381cbae to ac1cd59 Compare December 17, 2025 18:51
@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Dec 17, 2025
@fgimenez fgimenez added this pull request to the merge queue Dec 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2025
@fgimenez fgimenez added this pull request to the merge queue Dec 17, 2025
Merged via the queue into main with commit 9ae62aa Dec 17, 2025
44 checks passed
@fgimenez fgimenez deleted the fgimenez/rocksdb-table-invariants branch December 17, 2025 20:35
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Dec 17, 2025
yongkangc added a commit that referenced this pull request Jan 22, 2026
…ility

- Fix clippy doc_markdown warning: add backticks around 'static_file'
- Fix TODO link: use issue #18983 instead of PR #20340
- Add observability logs for empty RocksDB history tables with non-zero checkpoint
- Add debug_assert + warning when duplicate history indices are detected

Amp-Thread-ID: https://ampcode.com/threads/T-019be55f-a227-7054-ac77-61654cb7c823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add method to check invariants on RocksDB tables

2 participants