This is an automated email from the ASF dual-hosted git repository. junrao pushed a commit to branch 3.0 in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/3.0 by this push: new 29d3484 KAFKA-13391: don't fsync directory on Windows OS (#11426) 29d3484 is described below commit 29d3484343e28ee4c0772134f72f00b5ba988a04 Author: Luke Chen <show...@gmail.com> AuthorDate: Tue Oct 26 01:12:07 2021 +0800 KAFKA-13391: don't fsync directory on Windows OS (#11426) Reviewers: Cong Ding <c...@ccding.com>, Jun Rao <jun...@gmail.com> --- clients/src/main/java/org/apache/kafka/common/utils/Utils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java index 4036f45..b427880 100755 --- a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java +++ b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java @@ -946,10 +946,12 @@ public final class Utils { /** * Flushes dirty directories to guarantee crash consistency. * + * Note: We don't fsync directories on Windows OS because otherwise it'll throw AccessDeniedException (KAFKA-13391) + * * @throws IOException if flushing the directory fails. */ public static void flushDir(Path path) throws IOException { - if (path != null) { + if (path != null && !OperatingSystem.IS_WINDOWS) { try (FileChannel dir = FileChannel.open(path, StandardOpenOption.READ)) { dir.force(true); }