Expose exact transaction log positions - #1
Closed
ronag wants to merge 3 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends RocksDB’s transaction log iterator to expose stable, exact WAL positioning metadata (WAL file number, logical record start/end offsets, and XXH3 checksum) via TransactionLogIterator::BatchResult, and updates iterator behavior to make log-data-only tail records visible and resumable while preserving cursor metadata across tailing.
Changes:
- Add WAL position + checksum fields to
BatchResultand propagate them from the WAL reader. - Adjust transaction log iteration so zero-count (e.g., log-data-only) records are visible at a clean WAL tail, and consuming records aren’t exposed until their full sequence range is published.
- Add unit tests covering log-data-only tail behavior, WAL position/checksum propagation, and unpublished consuming-record visibility; add a new SyncPoint in the write path to support the test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| include/rocksdb/transaction_log.h | Extends public BatchResult with WAL location + checksum fields; clarifies iterator tailing semantics in comments. |
| db/transaction_log_impl.h | Adds internal state to track per-record WAL metadata and buffer unpublished consuming records until published. |
| db/transaction_log_impl.cc | Implements publication gating, captures WAL offsets/checksum from log::Reader, and propagates metadata to BatchResult. |
| db/db_log_iter_test.cc | Adds tests for log-data-only tail visibility, WAL position/checksum, and unpublished consuming-record gating. |
| db/db_impl/db_impl_write.cc | Adds a SyncPoint after WAL write to deterministically test unpublished consuming-record behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+63
to
+79
| struct BatchResult { | ||
| SequenceNumber sequence = 0; | ||
|
|
||
| // The WAL file number containing this batch. Together with | ||
| // wal_record_offset, this identifies the batch while the WAL is retained. | ||
| uint64_t wal_file_number = 0; | ||
|
|
||
| // The physical byte offset of the first fragment of this logical WAL record. | ||
| uint64_t wal_record_offset = 0; | ||
|
|
||
| // The first physical byte offset after this logical WAL record. | ||
| uint64_t wal_record_end = 0; | ||
|
|
||
| // XXH3 checksum of the logical WAL record contents, or zero when | ||
| // ReadOptions::include_wal_record_checksum_ is false. | ||
| uint64_t wal_record_checksum = 0; | ||
|
|
Member
Author
|
Closing this approach because it requires modifying RocksDB. I am replacing it with a rocks-level-only implementation against the unchanged v11.1.1 dependency. |
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
BatchResultTransactionLogIterator::ReadOptionsThis intentionally targets the
v11.1.1maintenance branch created from the exact RocksDB version consumed bynxtedition/rocks-level. No upstream PR is opened.Validation
make -j8 db_log_iter_test CC='ccache clang' CXX='ccache clang++'./db_log_iter_test(11/11)git diff --check