Fix that WALBuffer waits for flush instead of file-roll#17628
Open
Fix that WALBuffer waits for flush instead of file-roll#17628
Conversation
JackieTien97
requested changes
May 9, 2026
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17628 +/- ##
============================================
+ Coverage 40.23% 40.24% +0.01%
Complexity 2554 2554
============================================
Files 5177 5177
Lines 348880 348884 +4
Branches 44624 44624
============================================
+ Hits 140363 140400 +37
+ Misses 208517 208484 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
WALNode.ReqIteratorusedwaitForFlush(signaled on buffer sync) to wait for new WAL data, but data only becomes readable after a WAL file roll — not a buffer flush. This caused the iterator to wake up prematurely (on flush) and then loop/timeout, or miss data entirely.rollLogWriterConditioninWALBufferthat is signaled only whenrollLogWritercreates a new WAL file. RenamedwaitForFlush→waitForRollFileacrossIWALBuffer/WALBuffer/WALNodeto reflect the corrected semantics.waitForNextReady(time, unit), changedtimeout || !hasNext()totimeout && !hasNext()— previously a successful (non-timeout) wake-up could still throwTimeoutExceptionifhasNext()happened to return false during a race.tryToCollectInsertNodeAndBumpIndex.run()before updating file index so the iterator processes entries from the current file before advancing.Changed files
IWALBuffer.java— renamed interface methodswaitForFlush→waitForRollFileWALBuffer.java— addedrollLogWriterCondition, signal it inrollLogWriter(), use it in the renamedwaitForRollFilemethodsWALNode.java— updated all call sites, fixedtimeout || !hasNext()→timeout && !hasNext(), reordered collect callTest plan
WALNodeWaitForRollFileTestwith 5 tests covering: