From 7b67543cd965bcdb5a092515acc0ee7372ee2558 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Tue, 18 Jul 2023 17:39:03 -0700 Subject: [PATCH] Self review Signed-off-by: Suraj Singh --- .../store/remote/metadata/RemoteSegmentMetadata.java | 9 --------- .../indices/replication/GetSegmentFilesResponse.java | 8 ++++---- .../indices/replication/SegmentReplicationTarget.java | 7 ++----- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/store/remote/metadata/RemoteSegmentMetadata.java b/server/src/main/java/org/opensearch/index/store/remote/metadata/RemoteSegmentMetadata.java index 01f1e5ce20879..befec685754c2 100644 --- a/server/src/main/java/org/opensearch/index/store/remote/metadata/RemoteSegmentMetadata.java +++ b/server/src/main/java/org/opensearch/index/store/remote/metadata/RemoteSegmentMetadata.java @@ -39,15 +39,6 @@ public class RemoteSegmentMetadata { private final byte[] segmentInfosBytes; - // private final long primaryTerm; - // private final long generation; - // - // private final long version; - // - // private final long length; - // - // private final String codec; - public ReplicationCheckpoint getReplicationCheckpoint() { return replicationCheckpoint; } diff --git a/server/src/main/java/org/opensearch/indices/replication/GetSegmentFilesResponse.java b/server/src/main/java/org/opensearch/indices/replication/GetSegmentFilesResponse.java index 222b1cfaa8574..33a84833f2418 100644 --- a/server/src/main/java/org/opensearch/indices/replication/GetSegmentFilesResponse.java +++ b/server/src/main/java/org/opensearch/indices/replication/GetSegmentFilesResponse.java @@ -23,10 +23,6 @@ */ public class GetSegmentFilesResponse extends TransportResponse { - public List getFiles() { - return files; - } - List files; public GetSegmentFilesResponse(List files) { @@ -37,6 +33,10 @@ public GetSegmentFilesResponse(StreamInput out) throws IOException { out.readList(StoreFileMetadata::new); } + public List getFiles() { + return files; + } + @Override public void writeTo(StreamOutput out) throws IOException { out.writeCollection(files); diff --git a/server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTarget.java b/server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTarget.java index 8cd8d782d1004..ee4490e94fdb5 100644 --- a/server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTarget.java +++ b/server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTarget.java @@ -32,7 +32,6 @@ import org.opensearch.indices.replication.common.ReplicationTarget; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; @@ -146,7 +145,7 @@ public void startReplication(ActionListener listener) { final StepListener checkpointInfoListener = new StepListener<>(); final StepListener getFilesListener = new StepListener<>(); - logger.info(new ParameterizedMessage("Starting Replication Target: {}", description())); + logger.trace(new ParameterizedMessage("Starting Replication Target: {}", description())); // Get list of files to copy from this checkpoint. state.setStage(SegmentReplicationState.Stage.GET_CHECKPOINT_INFO); cancellableThreads.checkForCancel(); @@ -156,12 +155,10 @@ public void startReplication(ActionListener listener) { final List filesToFetch = getFiles(checkpointInfo); state.setStage(SegmentReplicationState.Stage.GET_FILES); cancellableThreads.checkForCancel(); - logger.info("--> Before getFiles {}", Arrays.toString(indexShard.store().directory().listAll())); source.getSegmentFiles(getId(), checkpointInfo.getCheckpoint(), filesToFetch, indexShard, getFilesListener); }, listener::onFailure); getFilesListener.whenComplete(response -> { - logger.info("--> After getFiles {}", Arrays.toString(indexShard.store().directory().listAll())); finalizeReplication(checkpointInfoListener.result(), getFilesListener.result()); listener.onResponse(null); }, listener::onFailure); @@ -262,7 +259,7 @@ private void finalizeReplication(CheckpointInfoResponse checkpointInfoResponse, @Override public void cancel(String reason) { if (finished.get() == false) { - logger.info(new ParameterizedMessage("Cancelling replication for target {}", description())); + logger.trace(new ParameterizedMessage("Cancelling replication for target {}", description())); cancellableThreads.cancel(reason); source.cancel(); }