feat(stages): implement RocksDB unwind for index history stages#21066
Closed
yongkangc wants to merge 1 commit intoyk/rocksdb-stage-utilsfrom
Closed
feat(stages): implement RocksDB unwind for index history stages#21066yongkangc wants to merge 1 commit intoyk/rocksdb-stage-utilsfrom
yongkangc wants to merge 1 commit intoyk/rocksdb-stage-utilsfrom
Conversation
This was referenced Jan 14, 2026
42452c2 to
071cd7b
Compare
fff917c to
d8a600c
Compare
This was referenced Jan 14, 2026
8910828 to
126621c
Compare
gakonst
reviewed
Jan 16, 2026
Member
gakonst
left a comment
There was a problem hiding this comment.
Code Review: PR #21066
CI Status
- ❌ fmt, docs, unit tests failing
Changes Summary
Implements RocksDB unwind for AccountsHistory and StoragesHistory stages.
Review Notes
✅ Good
- Uses
EitherWriterpattern consistently with execution path - Proper grouping of changesets by address before unwinding - smart optimization to only unwind once per address using the LOWEST block number
- Good test coverage with dedicated
rocksdb_stage_testsmodule
🟡 Suggestions
-
Unwind correctness: The unwind logic groups by address and finds minimum block:
account_keys.entry(account.address) .and_modify(|min_bn| *min_bn = (*min_bn).min(block_number)) .or_insert(block_number);
This is correct - we only need to unwind once per address from the lowest affected block.
-
Memory consideration:
collect::<Result<Vec<_>, _>>()loads all changesets into memory. For large unwinds, consider processing in batches or using the cursor directly. -
Comment removal: The old comment
// from HistoryIndex higher than that number.was removed but the new code should have equivalent documentation explaining the unwind strategy.
Dependencies
Depends on #21063, #21064, #21065 - these must pass CI first.
Review by @tempo_ai
fc776db to
057d87f
Compare
126621c to
968c76f
Compare
Add RocksDB unwind support for IndexAccountHistory and IndexStorageHistory stages: - Create RocksDB batch during unwind when storage settings enabled - Use EitherWriter for history shard operations - Register batches with pending_batches for atomic commit
968c76f to
3c7fd84
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RocksDB unwind support for index history stages.
Changes
Testing
Unwind operations verified.
PR Stack