Skip to content

Commit 41d77a2

Browse files
author
Anshu Agarwal
committed
refactor code
Signed-off-by: Anshu Agarwal <[email protected]>
1 parent 42975ed commit 41d77a2

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteRestoreSnapshotIT.java

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -800,41 +800,4 @@ public void testCentralizedCreateAndRestoreShallowCopy() throws Exception {
800800
assertDocsPresentInIndex(client(), restoredIndexName1, numDocsInIndex1);
801801
}
802802

803-
public void testCentralizedCreate() throws Exception {
804-
805-
Settings snapshotSettings = Settings.builder().put("snapshot.centralized_create_operation", true).build();
806-
internalCluster().startClusterManagerOnlyNode(Settings.builder().put(snapshotSettings).build());
807-
internalCluster().startDataOnlyNode(Settings.builder().put(snapshotSettings).build());
808-
String indexName1 = "testindex1";
809-
String indexName2 = "testindex2";
810-
String snapshotRepoName = "test-create-snapshot-repo";
811-
String snapshotName1 = "test-create-snapshot1";
812-
Path absolutePath1 = randomRepoPath().toAbsolutePath();
813-
logger.info("Snapshot Path [{}]", absolutePath1);
814-
String restoredIndexName1 = indexName1 + "-restored";
815-
816-
createRepository(snapshotRepoName, "fs", getRepositorySettings(absolutePath1, true));
817-
818-
Client client = client();
819-
Settings indexSettings = getIndexSettings(20, 0).build();
820-
createIndex(indexName1, indexSettings);
821-
822-
Settings indexSettings2 = getIndexSettings(15, 0).build();
823-
createIndex(indexName2, indexSettings2);
824-
825-
final int numDocsInIndex1 = 10;
826-
final int numDocsInIndex2 = 20;
827-
indexDocuments(client, indexName1, numDocsInIndex1);
828-
indexDocuments(client, indexName2, numDocsInIndex2);
829-
ensureGreen(indexName1, indexName2);
830-
831-
internalCluster().startDataOnlyNode(Settings.builder().put(snapshotSettings).build());
832-
logger.info("--> snapshot");
833-
834-
SnapshotInfo snapshotInfo = createSnapshot(snapshotRepoName, snapshotName1, new ArrayList<>(Arrays.asList(indexName1, indexName2)));
835-
assertThat(snapshotInfo.state(), equalTo(SnapshotState.SUCCESS));
836-
assertThat(snapshotInfo.successfulShards(), greaterThan(0));
837-
assertThat(snapshotInfo.successfulShards(), equalTo(snapshotInfo.totalShards()));
838-
839-
840-
}
803+
}

server/src/main/java/org/opensearch/snapshots/SnapshotsService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,11 @@ public void onFailure(final Exception e) {
685685
}
686686
}, batch.size());
687687
for (Map.Entry<IndexId, Map<ShardId, ShardSnapshotStatus>> entry : batch) {
688-
processIndexShards(snapshot, snapshotIdStr, entry.getKey(), entry.getValue(), finalListener);
688+
snapshotIndexShards(snapshot, snapshotIdStr, entry.getKey(), entry.getValue(), finalListener);
689689
}
690690
}
691691

692-
private void processIndexShards(
692+
private void snapshotIndexShards(
693693
Snapshot snapshot,
694694
String snapshotIdStr,
695695
IndexId indexId,
@@ -719,11 +719,11 @@ public void onFailure(final Exception e) {
719719
}
720720
}, shardStatusMap.size());
721721
for (Map.Entry<ShardId, ShardSnapshotStatus> entry : shardStatusMap.entrySet()) {
722-
processShardAndUpload(snapshot, snapshotIdStr, indexId, entry.getKey(), entry.getValue(), shardListener);
722+
snapshotShards(snapshot, snapshotIdStr, indexId, entry.getKey(), entry.getValue(), shardListener);
723723
}
724724
}
725725

726-
private void processShardAndUpload(
726+
private void snapshotShards(
727727
Snapshot snapshot,
728728
String snapshotIdStr,
729729
IndexId indexId,

0 commit comments

Comments
 (0)