From e22e6ed4e08bf7713d1eb5b5b66565367ad5b916 Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Wed, 4 Oct 2023 16:34:39 -0700 Subject: [PATCH] sync directory after file rename Signed-off-by: Marc Handalian --- .../blobstore/stream/read/listener/ReadContextListener.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main/java/org/opensearch/common/blobstore/stream/read/listener/ReadContextListener.java b/server/src/main/java/org/opensearch/common/blobstore/stream/read/listener/ReadContextListener.java index b464675ba3193..6ab9cff3fa458 100644 --- a/server/src/main/java/org/opensearch/common/blobstore/stream/read/listener/ReadContextListener.java +++ b/server/src/main/java/org/opensearch/common/blobstore/stream/read/listener/ReadContextListener.java @@ -94,6 +94,8 @@ private ActionListener> getFileCompletionListener() { try { IOUtils.fsync(tmpFileLocation, false); Files.move(tmpFileLocation, fileLocation, StandardCopyOption.ATOMIC_MOVE); + // sync parent dir metadata + IOUtils.fsync(fileLocation.getParent(), true); completionListener.onResponse(blobName); } catch (IOException e) { logger.error("Unable to rename temp file + " + tmpFileLocation, e);