chia7712 commented on code in PR #23441:
URL: https://github.com/apache/kafka/pull/23441#discussion_r4068207934


##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -987,12 +987,16 @@ public static void flushDirIfExists(Path path) throws 
IOException {
 
     /**
      * Flushes dirty file with swallowing {@link NoSuchFileException}
+     * <p>
+     * Note: We don't fsync files on Windows OS and z/OS because otherwise 
it'll throw AccessDeniedException (KAFKA-13391)
      */
     public static void flushFileIfExists(Path path) throws IOException {
-        try (FileChannel fileChannel = FileChannel.open(path, 
StandardOpenOption.READ)) {
-            fileChannel.force(true);
-        } catch (NoSuchFileException e) {
-            log.warn("Failed to flush file {}", path, e);
+        if (!OperatingSystem.IS_WINDOWS && !OperatingSystem.IS_ZOS) {

Review Comment:
   Would you mind adding a little helper to handle the flush for both 
`flushFileIfExists` and `flushDir`? 



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