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 17, 2022
1 parent 05ef18c commit 9fbc35f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import static org.hamcrest.Matchers.nullValue;

@ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false)
public class MinimumMasterNodesIT extends OpenSearchIntegTestCase {
public class MinimumClusterManagerNodesIT extends OpenSearchIntegTestCase {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import static org.hamcrest.Matchers.nullValue;

@ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false)
public class SpecificMasterNodesIT extends OpenSearchIntegTestCase {
public class SpecificClusterManagerNodesIT extends OpenSearchIntegTestCase {

public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
internalCluster().setBootstrapClusterManagerNodeIndex(0);
Expand Down Expand Up @@ -159,7 +159,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
);
}

public void testElectOnlyBetweenMasterNodes() throws Exception {
public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
internalCluster().setBootstrapClusterManagerNodeIndex(0);
logger.info("--> start data node / non cluster-manager node");
internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* not detect a cluster-manager failure too quickly.
*/
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
public class StableMasterDisruptionIT extends OpenSearchIntegTestCase {
public class StableClusterManagerDisruptionIT extends OpenSearchIntegTestCase {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
Expand All @@ -87,7 +87,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
/**
* Test that no split brain occurs under partial network partition. See https://github.com/elastic/elasticsearch/issues/2488
*/
public void testFailWithMinimumMasterNodesConfigured() throws Exception {
public void testFailWithMinimumClusterManagerNodesConfigured() throws Exception {
List<String> nodes = internalCluster().startNodes(3);
ensureStableCluster(3);

Expand All @@ -96,9 +96,9 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception {
logger.info("---> legit elected cluster-manager node={}", clusterManagerNode);

// Pick a node that isn't the elected cluster-manager.
Set<String> nonMasters = new HashSet<>(nodes);
nonMasters.remove(clusterManagerNode);
final String unluckyNode = randomFrom(nonMasters.toArray(Strings.EMPTY_ARRAY));
Set<String> nonClusterManagers = new HashSet<>(nodes);
nonClusterManagers.remove(clusterManagerNode);
final String unluckyNode = randomFrom(nonClusterManagers.toArray(Strings.EMPTY_ARRAY));

// Simulate a network issue between the unlucky node and elected cluster-manager node in both directions.

Expand Down Expand Up @@ -167,11 +167,11 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType
ensureStableCluster(3);

final String clusterManager = internalCluster().getMasterName();
final List<String> nonMasters = Arrays.stream(internalCluster().getNodeNames())
final List<String> nonClusterManagers = Arrays.stream(internalCluster().getNodeNames())
.filter(n -> clusterManager.equals(n) == false)
.collect(Collectors.toList());
final String isolatedNode = randomFrom(nonMasters);
final String otherNode = nonMasters.get(nonMasters.get(0).equals(isolatedNode) ? 1 : 0);
final String isolatedNode = randomFrom(nonClusterManagers);
final String otherNode = nonClusterManagers.get(nonClusterManagers.get(0).equals(isolatedNode) ? 1 : 0);

logger.info("--> isolating [{}]", isolatedNode);

Expand Down Expand Up @@ -230,8 +230,8 @@ public void testStaleMasterNotHijackingMajority() throws Exception {
event.previousState()
);
String previousClusterManagerNodeName = previousClusterManager != null ? previousClusterManager.getName() : null;
String currentMasterNodeName = currentClusterManager != null ? currentClusterManager.getName() : null;
clusterManagers.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName));
String currentClusterManagerNodeName = currentClusterManager != null ? currentClusterManager.getName() : null;
clusterManagers.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentClusterManagerNodeName));
}
});
}
Expand Down Expand Up @@ -274,8 +274,8 @@ public void onFailure(String source, Exception e) {
});

// Save the new elected cluster-manager node
final String newMasterNode = internalCluster().getMasterName(majoritySide.get(0));
logger.info("--> new detected cluster-manager node [{}]", newMasterNode);
final String newClusterManagerNode = internalCluster().getMasterName(majoritySide.get(0));
logger.info("--> new detected cluster-manager node [{}]", newClusterManagerNode);

// Stop disruption
logger.info("--> unfreezing node [{}]", oldClusterManagerNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw
assertFalse(blockedClone.isDone());
unblockNode(repoName, clusterManagerName);
awaitNumberOfSnapshotsInProgress(1);
awaitMasterFinishRepoOperations();
awaitClusterManagerFinishRepoOperations();
unblockNode(repoName, dataNode);
assertAcked(blockedClone.get());
assertEquals(getSnapshot(repoName, cloneName).state(), SnapshotState.SUCCESS);
Expand Down Expand Up @@ -569,7 +569,7 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E
assertFalse(blockedClone.isDone());
unblockNode(repoName, clusterManagerName);
awaitNoMoreRunningOperations(clusterManagerName);
awaitMasterFinishRepoOperations();
awaitClusterManagerFinishRepoOperations();
assertAcked(blockedClone.get());
assertAcked(otherClone.get());
assertEquals(getSnapshot(repoName, cloneName).state(), SnapshotState.SUCCESS);
Expand Down Expand Up @@ -607,7 +607,7 @@ public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throw
}
awaitNoMoreRunningOperations();

awaitMasterFinishRepoOperations();
awaitClusterManagerFinishRepoOperations();

assertSuccessful(blockedSnapshot);
assertAcked(clone.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exc
unblockNode(repoName, clusterManagerName);
awaitNumberOfSnapshotsInProgress(1);

awaitMasterFinishRepoOperations();
awaitClusterManagerFinishRepoOperations();

unblockNode(repoName, dataNode);
assertSuccessful(blockedSnapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ protected SnapshotInfo getSnapshot(String repository, String snapshot) {
return snapshotInfos.get(0);
}

protected void awaitMasterFinishRepoOperations() throws Exception {
protected void awaitClusterManagerFinishRepoOperations() throws Exception {
logger.info("--> waiting for cluster-manager to finish all repo operations on its SNAPSHOT pool");
final ThreadPool clusterManagerThreadPool = internalCluster().getMasterNodeInstance(ThreadPool.class);
assertBusy(() -> {
Expand Down

0 comments on commit 9fbc35f

Please sign in to comment.