Skip to content

Commit

Permalink
Incorporate PR review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Sep 18, 2023
1 parent e74b1c1 commit 5595fc2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ private boolean syncToDisk() throws IOException {
@Override
public void sync() throws IOException {
try {
if (syncToDisk() || syncNeeded() || prepareForUpload(null)) {
if ((syncToDisk() || syncNeeded()) && prepareForUpload(null)) {
performUpload(primaryTermSupplier.getAsLong(), null);
}
} catch (final Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public boolean transferSnapshot(TransferSnapshot transferSnapshot, TranslogTrans
long prevUploadBytesSucceeded = remoteTranslogTransferTracker.getUploadBytesSucceeded();
long prevUploadTimeInMillis = remoteTranslogTransferTracker.getTotalUploadTimeInMillis();

try {
try (translogTransferListener) {
toUpload.addAll(fileTransferTracker.exclusionFilter(transferSnapshot.getTranslogFileSnapshots()));
toUpload.addAll(fileTransferTracker.exclusionFilter((transferSnapshot.getCheckpointFileSnapshots())));
if (toUpload.isEmpty()) {
Expand Down Expand Up @@ -191,8 +191,6 @@ public boolean transferSnapshot(TransferSnapshot transferSnapshot, TranslogTrans
captureStatsOnUploadFailure();
translogTransferListener.onUploadFailed(transferSnapshot, ex);
return false;
} finally {
translogTransferListener.close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@

import org.opensearch.index.translog.transfer.TransferSnapshot;

import java.io.Closeable;
import java.io.IOException;

/**
* The listener to be invoked on the completion or failure of a {@link TransferSnapshot}
*
* @opensearch.internal
*/
public interface TranslogTransferListener extends Closeable {
public interface TranslogTransferListener extends AutoCloseable {
/**
* Invoked when the transfer of {@link TransferSnapshot} succeeds
* @param transferSnapshot the transfer snapshot
Expand Down

0 comments on commit 5595fc2

Please sign in to comment.