jt2594838 opened a new pull request, #17628:
URL: https://github.com/apache/iotdb/pull/17628

   ## Summary
   
   - **Bug**: `WALNode.ReqIterator` used `waitForFlush` (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.
   - **Fix**: Introduced a dedicated `rollLogWriterCondition` in `WALBuffer` 
that is signaled only when `rollLogWriter` creates a new WAL file. Renamed 
`waitForFlush` → `waitForRollFile` across `IWALBuffer`/`WALBuffer`/`WALNode` to 
reflect the corrected semantics.
   - **Additional fix**: In `waitForNextReady(time, unit)`, changed `timeout || 
!hasNext()` to `timeout && !hasNext()` — previously a successful (non-timeout) 
wake-up could still throw `TimeoutException` if `hasNext()` happened to return 
false during a race.
   - Added `tryToCollectInsertNodeAndBumpIndex.run()` before updating file 
index so the iterator processes entries from the current file before advancing.
   
   ## Changed files
   
   - `IWALBuffer.java` — renamed interface methods `waitForFlush` → 
`waitForRollFile`
   - `WALBuffer.java` — added `rollLogWriterCondition`, signal it in 
`rollLogWriter()`, use it in the renamed `waitForRollFile` methods
   - `WALNode.java` — updated all call sites, fixed `timeout || !hasNext()` → 
`timeout && !hasNext()`, reordered collect call
   
   ## Test plan
   
   - [x] Added `WALNodeWaitForRollFileTest` with 5 tests covering:
     - Timeout when no data is available
     - Flush without roll does **not** wake the iterator
     - Explicit roll wakes the iterator
     - Concurrent roll wakes a waiting iterator
     - Auto-roll on WAL file size threshold
     - Auto-triggered roll after timeout expiry


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to