diff --git a/core/src/main/java/org/elasticsearch/index/translog/Translog.java b/core/src/main/java/org/elasticsearch/index/translog/Translog.java index d6457e1d32a..8d2be410413 100644 --- a/core/src/main/java/org/elasticsearch/index/translog/Translog.java +++ b/core/src/main/java/org/elasticsearch/index/translog/Translog.java @@ -541,6 +541,9 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC } } + /** + * Returns true if an fsync is required to ensure durability of the translogs operations or it's metadata. + */ public boolean syncNeeded() { try (ReleasableLock lock = readLock.acquire()) { return current.syncNeeded(); diff --git a/core/src/main/java/org/elasticsearch/index/translog/TranslogWriter.java b/core/src/main/java/org/elasticsearch/index/translog/TranslogWriter.java index b4400f60b81..daf9a44b666 100644 --- a/core/src/main/java/org/elasticsearch/index/translog/TranslogWriter.java +++ b/core/src/main/java/org/elasticsearch/index/translog/TranslogWriter.java @@ -209,7 +209,8 @@ public class TranslogWriter extends BaseTranslogReader implements Closeable { } /** - * returns true if there are buffered ops + * Returns true if there are buffered operations that have not been flushed and fsynced to disk or if the latest global + * checkpoint has not yet been fsynced */ public boolean syncNeeded() { return totalOffset != lastSyncedCheckpoint.offset || globalCheckpointSupplier.getAsLong() != lastSyncedCheckpoint.globalCheckpoint;