Skip to content

Commit

Permalink
Add missing Java docs and minor clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Bukhtawar Khan <[email protected]>
  • Loading branch information
Bukhtawar committed Jun 2, 2022
1 parent d33cc03 commit c5bc432
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit c5bc432

Please sign in to comment.