diff --git a/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java b/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java index 990923f368359..6356bbd176765 100644 --- a/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java @@ -28,7 +28,7 @@ import java.util.stream.Stream; /** - * The {@link TranslogManager} implementation capable of orchestrating all {@link Translog} operations while + * The {@link TranslogManager} implementation capable of orchestrating all read/write {@link Translog} operations while * interfacing with the {@link org.opensearch.index.engine.InternalEngine} */ public class InternalTranslogManager implements TranslogManager { @@ -117,7 +117,7 @@ public void rollTranslogGeneration() throws TranslogException { * This operation will close the engine if the recovery fails. * @param translogRecoveryRunner the translog recovery runner * @param recoverUpToSeqNo the upper bound, inclusive, of sequence number to be recovered - * @return + * @return the total number of operations recovered */ @Override public int recoverFromTranslog(TranslogRecoveryRunner translogRecoveryRunner, long localCheckpoint, long recoverUpToSeqNo) @@ -190,6 +190,10 @@ public boolean ensureTranslogSynced(Stream locations) throws return synced; } + /** + * Syncs the translog and invokes the listener + * @throws IOException the exception on sync failure + */ @Override public void syncTranslog() throws IOException { translog.sync(); @@ -280,6 +284,9 @@ public int restoreLocalHistoryFromTranslog(long processedCheckpoint, TranslogRec } } + /** + * Ensures that the flushes can succeed if there are no pending translog recovery + */ @Override public void ensureCanFlush() { // translog recovery happens after the engine is fully constructed. @@ -320,6 +327,11 @@ private Translog openTranslog( ); } + /** + * Returns the the translog instance + * @param ensureOpen check if the engine is open + * @return the {@link Translog} instance + */ @Override public Translog getTranslog(boolean ensureOpen) { if (ensureOpen) { diff --git a/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java b/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java index 8109622ca4ce9..02120473bb15c 100644 --- a/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java @@ -15,7 +15,7 @@ import java.util.stream.Stream; /** - * The no-op implementation of {@link TranslogManager} that doesn't perform any action + * The no-op implementation of {@link TranslogManager} that doesn't perform any operation */ public class NoOpTranslogManager implements TranslogManager { diff --git a/server/src/main/java/org/opensearch/index/translog/WriteOnlyTranslogManager.java b/server/src/main/java/org/opensearch/index/translog/WriteOnlyTranslogManager.java index 31133ad1d9f50..bf2a6b316a023 100644 --- a/server/src/main/java/org/opensearch/index/translog/WriteOnlyTranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/WriteOnlyTranslogManager.java @@ -21,7 +21,7 @@ import java.util.function.Supplier; /*** - * The implementation of {@link TranslogManager} that only performs writes to the Translog + * The implementation of {@link TranslogManager} that only orchestrates writes to the underlying {@link Translog} */ public class WriteOnlyTranslogManager extends InternalTranslogManager {