mimaison commented on code in PR #23316:
URL: https://github.com/apache/kafka/pull/23316#discussion_r3990422662


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/AbstractIndex.java:
##########
@@ -252,12 +241,15 @@ public void renameTo(File f) throws IOException {
     }
 
     /**
-     * Flush the data in the index to disk
+     * Flush the data in the index and its metadata to disk
      */
-    public void flush() {
+    public void flush() throws IOException {
         inLock(() -> {
             if (mmap != null) {
                 mmap.force();
+                try (FileChannel channel = FileChannel.open(file.toPath(), 
StandardOpenOption.WRITE)) {

Review Comment:
   We already have `Utils.flushFileIfExists()` so instead I switched to that 
method. One difference is that method uses `READ` as the file mode. The javadoc 
is not clear on that point. I think this is fine as we're not actually making 
writes to the `FileChannel`. On my JDK it does not seem to require `WRITE`.



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