dataroaring opened a new pull request, #62063:
URL: https://github.com/apache/doris/pull/62063

   ## Summary
   
   - Both single-item `write()` and batch `write()` call 
`nextJournalId.getAndIncrement()` / `getAndAdd()` **before** the actual BDB 
put/commit
   - If the write fails (e.g. `ReplicaWriteException`, 
`InsufficientAcksException`), the journal IDs are permanently consumed but no 
journal entry exists
   - On retry, the write uses a new ID, creating gaps in the journal ID sequence
   - These gaps can confuse the replayer which expects contiguous journal IDs
   - Fix: read the current ID with `get()` before writing, advance with 
`incrementAndGet()` / `addAndGet()` only after successful commit. Both write 
methods are `synchronized`, so the pattern is safe.
   
   ## Test plan
   - [ ] Verify journal IDs remain contiguous after transient write failures
   - [ ] Verify replayer correctly replays all journals without gaps
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to