feat(stages): add RocksDB helper functions for stage operations#21065
Closed
yongkangc wants to merge 4 commits intoyk/rocksdb-shard-logicfrom
Closed
feat(stages): add RocksDB helper functions for stage operations#21065yongkangc wants to merge 4 commits intoyk/rocksdb-shard-logicfrom
yongkangc wants to merge 4 commits intoyk/rocksdb-shard-logicfrom
Conversation
This was referenced Jan 14, 2026
08d5ecf to
71e04e8
Compare
fff917c to
d8a600c
Compare
This was referenced Jan 14, 2026
71e04e8 to
d028b49
Compare
…ks_data Add append_account_history_shard and append_storage_history_shard methods to RocksDBBatch that properly handle shard boundaries. Update write_blocks_data to use these methods instead of the naive approach that just wrote to u64::MAX shard without checking existing shards.
d028b49 to
fc776db
Compare
gakonst
reviewed
Jan 16, 2026
Member
gakonst
left a comment
There was a problem hiding this comment.
Code Review: PR #21065
CI Status
- ❌ fmt, docs, crate-checks, unit tests failing
Changes Summary
Adds stage-level utilities for RocksDB operations including shard-and-write helpers and specialized loaders for account/storage history.
Review Notes
✅ Good
shard_and_writeis a nice generic helper that reduces duplication- Clean integration with
EitherWriterpattern - Proper handling of
LoadMode::FlushvsLoadMode::KeepLast
🟡 Suggestions
-
#[allow(dead_code)]: Multiple functions have this attribute. These should be removed once the functions are actually used by downstream PRs - verify they're used in #21066. -
Observability pattern: The progress logging pattern is good:
let interval = (total_entries / 10).max(1);
Consider extracting this into a reusable progress reporter helper.
-
Error context: When
decode_keyfails, consider adding context about which entry failed for debugging.
Dependencies
Depends on #21063 and #21064 - review those first.
Review by @tempo_ai
7a9e46f to
4b3b865
Compare
Add utility functions for RocksDB integration in stages: - make_rocksdb_provider() - creates RocksDB provider from UnifiedStorageWriter - make_rocksdb_batch_arg() - creates RocksDB batch for EitherWriter - register_rocksdb_batch() - registers batch with pending batches - collect_shards_for_unwind() - shared logic for history shard unwinding - Add RocksDBIntegrity enum variant for metadata
fc776db to
057d87f
Compare
…metrics - Add AccountsHistory and StoragesHistory to ROCKSDB_TABLES constant to fix panic when RocksDB consistency check accesses these tables - Make record_operation gracefully handle unknown tables instead of panicking, preventing future table additions from breaking tests - Improve shard_and_write performance by avoiding intermediate Vec<Vec<_>> allocation, instead iterating chunks directly
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
Helper functions for RocksDB integration in stage operations.
Changes
Testing
Stage operations verified.
PR Stack