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 3747ddfd276a3..bed43ba8f543c 100644 --- a/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/InternalTranslogManager.java @@ -142,8 +142,7 @@ public void recoverFromTranslog(TranslogRecoveryRunner translogRecoveryRunner, l } } - private void recoverFromTranslogInternal(TranslogRecoveryRunner translogRecoveryRunner, long localCheckpoint, long recoverUpToSeqNo) - throws IOException { + private void recoverFromTranslogInternal(TranslogRecoveryRunner translogRecoveryRunner, long localCheckpoint, long recoverUpToSeqNo) { final int opsRecovered; if (localCheckpoint < recoverUpToSeqNo) { try (Translog.Snapshot snapshot = translog.newSnapshot(localCheckpoint + 1, recoverUpToSeqNo)) { 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 33e99b4ef9227..bd53ecb73f50e 100644 --- a/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/NoOpTranslogManager.java @@ -14,6 +14,9 @@ import java.io.IOException; import java.util.stream.Stream; +/** + * The no-op implementation of {@link TranslogManager} that doesn't perform any action + */ public class NoOpTranslogManager implements TranslogManager { private final Translog.Snapshot emptyTranslogSnapshot; diff --git a/server/src/main/java/org/opensearch/index/translog/TranslogManager.java b/server/src/main/java/org/opensearch/index/translog/TranslogManager.java index c3b290389ba0f..8ea08aa561efc 100644 --- a/server/src/main/java/org/opensearch/index/translog/TranslogManager.java +++ b/server/src/main/java/org/opensearch/index/translog/TranslogManager.java @@ -43,13 +43,13 @@ public interface TranslogManager { /** * Syncs translog to disk - * @throws IOException + * @throws IOException the exception while performing the sync operation */ void syncTranslog() throws IOException; /** * Translog operation stats - * @return + * @return the translog stats */ TranslogStats getTranslogStats(); @@ -94,8 +94,8 @@ public interface TranslogManager { /** * Returns the instance of the translog with a precondition - * @param ensureOpen - * @return + * @param ensureOpen check if the engine is open + * @return the translog instance */ Translog getTranslog(boolean ensureOpen); diff --git a/server/src/main/java/org/opensearch/index/translog/TranslogRecoveryRunner.java b/server/src/main/java/org/opensearch/index/translog/TranslogRecoveryRunner.java index d523d2210c177..bff9995188b95 100644 --- a/server/src/main/java/org/opensearch/index/translog/TranslogRecoveryRunner.java +++ b/server/src/main/java/org/opensearch/index/translog/TranslogRecoveryRunner.java @@ -10,6 +10,9 @@ import java.io.IOException; +/** + * The interface that defines how translog operations will get replayed from a {@link Translog.Snapshot} + */ @FunctionalInterface public interface TranslogRecoveryRunner { int run(Translog.Snapshot snapshot) throws IOException; diff --git a/server/src/main/java/org/opensearch/index/translog/listener/package-info.java b/server/src/main/java/org/opensearch/index/translog/listener/package-info.java new file mode 100644 index 0000000000000..bfb2415881c10 --- /dev/null +++ b/server/src/main/java/org/opensearch/index/translog/listener/package-info.java @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ +/** + * Provides mechanism to listen into translog operations + */ +package org.opensearch.index.translog.listener;