NestDream opened a new pull request, #23368:
URL: https://github.com/apache/kafka/pull/23368

   `Utils.atomicMoveWithFallback` flushes the target's parent directory in a 
`finally` block. When both the atomic move and the fallback move fail and 
`flushDir` fails as well (the same situations break both: the target directory 
is gone, the disk is failing), the `finally` exception replaces the move 
exception, so the caller only sees the `flushDir` failure and the actual failed 
rename is lost. Callers include `CheckpointFile.write`, `LocalLog.renameDir`, 
the raft `FileQuorumStateStore` and the streams `OffsetCheckpoint`, so on a 
failing log dir the error that gets logged before the dir is taken offline 
describes the parent fsync instead of the rename that failed.
   
   This catches the `flushDir` failure on the error path and attaches it as a 
suppressed exception to the move failure, the same way `Utils.closeAll` chains 
exceptions. The success path is unchanged: a `flushDir` failure after a 
successful move still propagates.
   
   Testing: two new `UtilsTest` cases. One makes both moves and the flush fail 
(source missing, target under a missing directory) and asserts the caller sees 
the move failure with the flush failure suppressed; it fails on trunk with the 
move failure lost entirely. The other drops read permission on the target 
directory so the move succeeds and the flush fails, and asserts the flush 
failure still propagates. Also reproduced end to end with a single-node KRaft 
broker whose log dir is removed while running: with two builds of the 
distribution that differ only in the `kafka-clients` jar, trunk logs the 
parent-dir flush error when the checkpoint write fails, this change logs the 
actual failed rename.
   


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