Skip to content

Commit 22d2c3e

Browse files
author
Tianli Feng
committed
Replace master with cluster_manager in ConcurrentSnapshotsIT in server/src/internalClusterTest
Signed-off-by: Tianli Feng <ftianli@amazon.com>
1 parent 87d07e5 commit 22d2c3e

1 file changed

Lines changed: 30 additions & 18 deletions

File tree

server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,10 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception {
458458

459459
final String firstSnapshot = "snapshot-one";
460460
blockDataNode(repoName, dataNode);
461-
final ActionFuture<CreateSnapshotResponse> firstSnapshotResponse = startFullSnapshotFromNonMasterClient(repoName, firstSnapshot);
461+
final ActionFuture<CreateSnapshotResponse> firstSnapshotResponse = startFullSnapshotFromNonClusterManagerClient(
462+
repoName,
463+
firstSnapshot
464+
);
462465
waitForBlock(dataNode, repoName, TimeValue.timeValueSeconds(30L));
463466

464467
final String dataNode2 = internalCluster().startDataOnlyNode();
@@ -475,11 +478,14 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception {
475478
return snapshotsInProgress.entries().size() == 2 && snapshotHasCompletedShard(secondSnapshot, snapshotsInProgress);
476479
});
477480

478-
final ActionFuture<AcknowledgedResponse> firstDeleteFuture = startDeleteFromNonMasterClient(repoName, firstSnapshot);
481+
final ActionFuture<AcknowledgedResponse> firstDeleteFuture = startDeleteFromNonClusterManagerClient(repoName, firstSnapshot);
479482
awaitNDeletionsInProgress(1);
480483

481484
blockNodeOnAnyFiles(repoName, dataNode2);
482-
final ActionFuture<CreateSnapshotResponse> snapshotThreeFuture = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three");
485+
final ActionFuture<CreateSnapshotResponse> snapshotThreeFuture = startFullSnapshotFromNonClusterManagerClient(
486+
repoName,
487+
"snapshot-three"
488+
);
483489
waitForBlock(dataNode2, repoName, TimeValue.timeValueSeconds(30L));
484490

485491
assertThat(firstSnapshotResponse.isDone(), is(false));
@@ -488,7 +494,7 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception {
488494
logger.info("--> waiting for all three snapshots to show up as in-progress");
489495
assertBusy(() -> assertThat(currentSnapshots(repoName), hasSize(3)), 30L, TimeUnit.SECONDS);
490496

491-
final ActionFuture<AcknowledgedResponse> deleteAllSnapshots = startDeleteFromNonMasterClient(repoName, "*");
497+
final ActionFuture<AcknowledgedResponse> deleteAllSnapshots = startDeleteFromNonClusterManagerClient(repoName, "*");
492498
logger.info("--> wait for delete to be enqueued in cluster state");
493499
awaitClusterState(state -> {
494500
final SnapshotDeletionsInProgress deletionsInProgress = state.custom(SnapshotDeletionsInProgress.TYPE);
@@ -552,15 +558,21 @@ public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception {
552558
index(testIndex, "_doc", "some_id", "foo", "bar");
553559

554560
blockDataNode(repoName, dataNode);
555-
final ActionFuture<CreateSnapshotResponse> firstSnapshotResponse = startFullSnapshotFromMasterClient(repoName, "snapshot-one");
561+
final ActionFuture<CreateSnapshotResponse> firstSnapshotResponse = startFullSnapshotFromClusterManagerClient(
562+
repoName,
563+
"snapshot-one"
564+
);
556565
waitForBlock(dataNode, repoName, TimeValue.timeValueSeconds(30L));
557566

558567
internalCluster().startDataOnlyNode();
559568
ensureStableCluster(3);
560569
ensureGreen(testIndex);
561570

562571
final String secondSnapshot = "snapshot-two";
563-
final ActionFuture<CreateSnapshotResponse> secondSnapshotResponse = startFullSnapshotFromMasterClient(repoName, secondSnapshot);
572+
final ActionFuture<CreateSnapshotResponse> secondSnapshotResponse = startFullSnapshotFromClusterManagerClient(
573+
repoName,
574+
secondSnapshot
575+
);
564576

565577
// make sure second snapshot is in progress before restarting data node
566578
waitUntilInprogress(repoName, secondSnapshot, TimeValue.timeValueSeconds(5L));
@@ -707,12 +719,12 @@ public void testQueuedOperationsOnClusterManagerDisconnectAndRepoFailure() throw
707719
internalCluster().setDisruptionScheme(networkDisruption);
708720

709721
blockMasterFromFinalizingSnapshotOnIndexFile(repoName);
710-
final ActionFuture<CreateSnapshotResponse> firstFailedSnapshotFuture = startFullSnapshotFromMasterClient(
722+
final ActionFuture<CreateSnapshotResponse> firstFailedSnapshotFuture = startFullSnapshotFromClusterManagerClient(
711723
repoName,
712724
"failing-snapshot-1"
713725
);
714726
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));
715-
final ActionFuture<CreateSnapshotResponse> secondFailedSnapshotFuture = startFullSnapshotFromMasterClient(
727+
final ActionFuture<CreateSnapshotResponse> secondFailedSnapshotFuture = startFullSnapshotFromClusterManagerClient(
716728
repoName,
717729
"failing-snapshot-2"
718730
);
@@ -756,7 +768,7 @@ public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws E
756768

757769
client().admin().cluster().prepareCreateSnapshot(repoName, "snapshot-three").setWaitForCompletion(false).get();
758770

759-
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteFromNonMasterClient(repoName, "*");
771+
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteFromNonClusterManagerClient(repoName, "*");
760772
awaitNDeletionsInProgress(2);
761773

762774
internalCluster().stopCurrentMasterNode();
@@ -780,12 +792,12 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver()
780792
final long generation = getRepositoryData(repoName).getGenId();
781793
final String clusterManagerNode = internalCluster().getMasterName();
782794
blockNodeOnAnyFiles(repoName, clusterManagerNode);
783-
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three");
795+
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three");
784796
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));
785797

786798
corruptIndexN(repoPath, generation);
787799

788-
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four");
800+
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four");
789801
internalCluster().stopCurrentMasterNode();
790802
ensureStableCluster(3);
791803

@@ -808,12 +820,12 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2()
808820
final long generation = getRepositoryData(repoName).getGenId();
809821
final String clusterManagerNode = internalCluster().getMasterName();
810822
blockMasterFromFinalizingSnapshotOnIndexFile(repoName);
811-
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three");
823+
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three");
812824
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));
813825

814826
corruptIndexN(repoPath, generation);
815827

816-
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four");
828+
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four");
817829
awaitNumberOfSnapshotsInProgress(2);
818830

819831
final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT);
@@ -844,24 +856,24 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMul
844856
createRepository(blockedRepoName, "mock");
845857
createNSnapshots(blockedRepoName, randomIntBetween(1, 5));
846858
blockNodeOnAnyFiles(blockedRepoName, clusterManagerNode);
847-
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteFromNonMasterClient(blockedRepoName, "*");
859+
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteFromNonClusterManagerClient(blockedRepoName, "*");
848860
waitForBlock(clusterManagerNode, blockedRepoName, TimeValue.timeValueSeconds(30L));
849861
awaitNDeletionsInProgress(1);
850-
final ActionFuture<CreateSnapshotResponse> createBlockedSnapshot = startFullSnapshotFromNonMasterClient(
862+
final ActionFuture<CreateSnapshotResponse> createBlockedSnapshot = startFullSnapshotFromNonClusterManagerClient(
851863
blockedRepoName,
852864
"queued-snapshot"
853865
);
854866
awaitNumberOfSnapshotsInProgress(1);
855867

856868
final long generation = getRepositoryData(repoName).getGenId();
857869
blockNodeOnAnyFiles(repoName, clusterManagerNode);
858-
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three");
870+
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three");
859871
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));
860872
awaitNumberOfSnapshotsInProgress(2);
861873

862874
corruptIndexN(repoPath, generation);
863875

864-
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four");
876+
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four");
865877
awaitNumberOfSnapshotsInProgress(3);
866878
internalCluster().stopCurrentMasterNode();
867879
ensureStableCluster(3);
@@ -1080,7 +1092,7 @@ public void testClusterManagerFailoverOnFinalizationLoop() throws Exception {
10801092
final List<String> snapshotNames = createNSnapshots(repoName, randomIntBetween(2, 5));
10811093
final String clusterManagerName = internalCluster().getMasterName();
10821094
blockMasterFromDeletingIndexNFile(repoName);
1083-
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromMasterClient(repoName, "snap-other");
1095+
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromClusterManagerClient(repoName, "snap-other");
10841096
waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L));
10851097

10861098
final String snapshotOne = snapshotNames.get(0);

0 commit comments

Comments
 (0)