-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix TVList iterator state across memtable page switches #18647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JackieTien97
merged 2 commits into
master
from
fix/aligned-tvlist-page-switch-duplicate-values
Sep 16, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Invalidate non-aligned batch state before preserving
probeNextnewIndex == indexdoes not guarantee thatprobeNextstill describes the current record. Non-alignedTVListIterator.nextBatch()advancesindexdirectly but does not clearprobeNextbefore returning. With this change, switching through an empty fake page preserves that staletrue, so subsequent point reads skipprepareNext()and can return duplicate timestamps or deleted points. This matters when an earlier non-overlapping page is read in batches and a later overlapping page is consumed through the point-reader path.For example, consider a single non-aligned
LongTVListwith these physical records, in write order:Read
[1,33]in batches, visit the empty page[34,66], then read[67,100]as points:hasNextBatch()prepares index 0 and setsprobeNext = true.nextBatch()emits(1,1), advances to index 1, and stops because time 100 exceeds the first page boundary. It leavesprobeNext = true, although index 1 has not been prepared for point reading.probeNext, allowinghasNextBatch()to prepare the time-100 group and advance to its latest record, index 2. After this change, preparation is skipped and index 1 remains selected.(100,2); the next read also emits(100,3).The same stale flag bypasses deletion checks. My ASC and DESC deletion variants both passed with the parent implementation and returned an extra deleted point with this PR.
Please clear
probeNextafter non-alignednextBatch()advances the cursor, as the aligned batch implementation already does, and cover the batch-to-point transition while retaining these aligned regressions.Minimal JUnit reproducer (imports omitted)
This minimal test supplies the page ranges explicitly. I also reproduced it with 300,000 physical rows: 299,998 records at time 1 followed by
(100,2)and(100,3).ReadOnlyMemChunknaturally generated[1,33],[34,66], and[67,100]; the same batch/batch/point sequence throughLazyMemVersionPageReaderandPriorityMergeReaderreturned[100:2, 100:3]on this PR and[100:3]with the parent implementation.