itoumlilt commented on code in PR #20289:
URL: https://github.com/apache/kafka/pull/20289#discussion_r2557245993


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java:
##########
@@ -634,6 +635,17 @@ public Void call() throws IOException {
                     return null;
                 }
             });
+        } catch (ClosedChannelException e) {
+            if (!log.file().exists()) {

Review Comment:
   @junrao  Thanks for the detailed review! You were right: handling this at 
the `flush()` level was incomplete as it didn't cover read operations.
   I've updated the PR to implement your suggestion:
   1. Reverted the changes to `LogSegment.java`.
   2. Modified `LogManager.replaceCurrentWithFutureLog` to not close the source 
log immediately. This keeps the channel open for any pending operations on the 
renamed (.delete) directory.
   3. Added a new unit test 
testReplaceCurrentWithFutureLogDoesNotCloseSourceLog in LogManagerTest to 
verify that the source log remains open during the swap.
   
   Please let me know if this looks good!



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