yangxianjungree opened a new pull request, #4854:
URL: https://github.com/apache/bookkeeper/pull/4854

   ### Motivation
   
   This draft PR adds a focused reproducer for a `BufferedChannel` failure mode 
that can leave the logical `BufferedChannel.position()` behind the underlying 
`FileChannel.position()` after a partial flush failure.
   
   The suspected production impact is stale entry locations and stale 
`ledgersMapOffset` being published by `DefaultEntryLogger` after the same 
channel is reused.
   
   This is intentionally a reproducer-only draft, not the final fix.
   
   ### Changes
   
   - Add a fault-injected `PartialFailingFileChannel` for tests.
   - Add a test showing `BufferedChannel.position()` can lag behind 
`FileChannel.position()` after a partial flush `IOException`.
   - Add a test showing `BufferedLogChannel.appendLedgersMap()` can write a 
stale `ledgersMapOffset` after that position drift.
   
   ### Verification
   
   Passed on `release-4.16.7` baseline:
   
   ```text
   /home/stephen/github/java/pulsar/mvnw -pl bookkeeper-server 
-Dtest=BufferedChannelTest test
   Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   After rebasing onto current `branch-4.16`, running with `-am` did not reach 
tests in this local environment due to a Maven resource copy error in 
`buildtools`:
   
   ```text
   Failed to copy buildtools/src/main/resources/bookkeeper/checkstyle.xml ... 
Cannot allocate memory
   ```
   
   ### Notes
   
   If maintainers agree with the failure model, the follow-up fix should likely 
make the main entrylog writer fail closed after non-recoverable 
write/flush/force failures, and prevent `appendLedgersMap()` from publishing a 
stale header offset.
   


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