junrao commented on code in PR #20289:
URL: https://github.com/apache/kafka/pull/20289#discussion_r2279711416
##########
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:
In `replaceCurrentWithFutureLog()`, we rename the log dir to deleted, close
the channel and schedule it to be deleted asynchronously. If we get here, it's
possible that the renamed file still exists.
Also, while this fixes the issue with flush, the issue with closed channel
could be exposed through read too and therefore cause the same issue of forcing
the log directory to be offline.
An alternative is to avoid closing `srcLog` in
`replaceCurrentWithFutureLog()`. The segments will be closed when the log is
deleted after a delay. By that time, the expectation is that there won't be any
pending flushes, reads, etc on the log. This approach is also consistent with
the approach in `LogManager.asyncDelete()`.
--
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]