Skip to content

Commit

Permalink
Replace master with cluster_manager in server/src/internalClusterTest
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed May 18, 2022
1 parent 02af408 commit 87d07e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,13 @@ private void assertConcreteMappingsOnAll(final String index, final String... fie
assertNotNull("field " + fieldName + " doesn't exists on " + node, fieldType);
}
}
assertMappingOnMaster(index, fieldNames);
assertMappingOnClusterManager(index, fieldNames);
}

/**
* Waits for the given mapping type to exists on the cluster-manager node.
*/
private void assertMappingOnMaster(final String index, final String... fieldNames) {
private void assertMappingOnClusterManager(final String index, final String... fieldNames) {
GetMappingsResponse response = client().admin().indices().prepareGetMappings(index).get();
MappingMetadata mappings = response.getMappings().get(index);
assertThat(mappings, notNullValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception {
createFullSnapshot(repoName, sourceSnapshot);

final String targetSnapshot = "target-snapshot";
blockMasterOnShardClone(repoName);
blockClusterManagerOnShardClone(repoName);
final ActionFuture<AcknowledgedResponse> cloneFuture = startClone(repoName, sourceSnapshot, targetSnapshot, indexSlow);
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));

Expand Down Expand Up @@ -336,7 +336,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception {
assertAcked(admin().indices().prepareDelete(indexBlocked).get());

final String targetSnapshot1 = "target-snapshot";
blockMasterOnShardClone(repoName);
blockClusterManagerOnShardClone(repoName);
final ActionFuture<AcknowledgedResponse> cloneFuture1 = startClone(repoName, sourceSnapshot, targetSnapshot1, indexBlocked);
waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L));
assertThat(cloneFuture1.isDone(), is(false));
Expand Down Expand Up @@ -388,7 +388,7 @@ public void testClusterManagerFailoverDuringCloneStep1() throws Exception {
final String sourceSnapshot = "source-snapshot";
createFullSnapshot(repoName, sourceSnapshot);

blockMasterOnReadIndexMeta(repoName);
blockClusterManagerOnReadIndexMeta(repoName);
final String cloneName = "target-snapshot";
final ActionFuture<AcknowledgedResponse> cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, cloneName, testIndex);
awaitNumberOfSnapshotsInProgress(1);
Expand Down Expand Up @@ -444,7 +444,7 @@ public void testClusterManagerFailoverDuringCloneStep2() throws Exception {
createFullSnapshot(repoName, sourceSnapshot);

final String targetSnapshot = "target-snapshot";
blockMasterOnShardClone(repoName);
blockClusterManagerOnShardClone(repoName);
final ActionFuture<AcknowledgedResponse> cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex);
awaitNumberOfSnapshotsInProgress(1);
final String clusterManagerNode = internalCluster().getMasterName();
Expand Down Expand Up @@ -642,12 +642,12 @@ private static ActionFuture<AcknowledgedResponse> startClone(
return client.admin().cluster().prepareCloneSnapshot(repoName, sourceSnapshot, targetSnapshot).setIndices(indices).execute();
}

private void blockMasterOnReadIndexMeta(String repoName) {
private void blockClusterManagerOnReadIndexMeta(String repoName) {
((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName))
.setBlockOnReadIndexMeta();
}

private void blockMasterOnShardClone(String repoName) {
private void blockClusterManagerOnShardClone(String repoName) {
((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName))
.setBlockOnWriteShardLevelMeta();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1417,12 +1417,12 @@ private List<String> createNSnapshots(String repoName, int count) {
return snapshotNames;
}

private ActionFuture<AcknowledgedResponse> startDeleteFromNonMasterClient(String repoName, String snapshotName) {
private ActionFuture<AcknowledgedResponse> startDeleteFromNonClusterManagerClient(String repoName, String snapshotName) {
logger.info("--> deleting snapshot [{}] from repo [{}] from non cluster-manager client", snapshotName, repoName);
return internalCluster().nonMasterClient().admin().cluster().prepareDeleteSnapshot(repoName, snapshotName).execute();
}

private ActionFuture<CreateSnapshotResponse> startFullSnapshotFromNonMasterClient(String repoName, String snapshotName) {
private ActionFuture<CreateSnapshotResponse> startFullSnapshotFromNonClusterManagerClient(String repoName, String snapshotName) {
logger.info("--> creating full snapshot [{}] to repo [{}] from non cluster-manager client", snapshotName, repoName);
return internalCluster().nonMasterClient()
.admin()
Expand All @@ -1432,7 +1432,7 @@ private ActionFuture<CreateSnapshotResponse> startFullSnapshotFromNonMasterClien
.execute();
}

private ActionFuture<CreateSnapshotResponse> startFullSnapshotFromMasterClient(String repoName, String snapshotName) {
private ActionFuture<CreateSnapshotResponse> startFullSnapshotFromClusterManagerClient(String repoName, String snapshotName) {
logger.info("--> creating full snapshot [{}] to repo [{}] from cluster-manager client", snapshotName, repoName);
return internalCluster().masterClient()
.admin()
Expand Down

0 comments on commit 87d07e5

Please sign in to comment.