Skip to content

Commit

Permalink
Replace 'master' terminology with 'cluster manager' in server/src/int…
Browse files Browse the repository at this point in the history
…ernalClusterTest directory

Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed May 13, 2022
1 parent f69155f commit 8cb690c
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testMasterFailoverDuringIndexingWithMappingChanges() throws Throwabl
logger.info("--> wait for all nodes to join the cluster");
ensureStableCluster(4);

// We index data with mapping changes into cluster and have master failover at same time
// We index data with mapping changes into cluster and have cluster-manager failover at same time
client().admin()
.indices()
.prepareCreate("myindex")
Expand Down Expand Up @@ -108,14 +108,14 @@ public void run() {

barrier.await();

// interrupt communication between master and other nodes in cluster
// interrupt communication between cluster-manager and other nodes in cluster
NetworkDisruption partition = isolateMasterDisruption(NetworkDisruption.DISCONNECT);
internalCluster().setDisruptionScheme(partition);

logger.info("--> disrupting network");
partition.startDisrupting();

logger.info("--> waiting for new master to be elected");
logger.info("--> waiting for new cluster-manager to be elected");
ensureStableCluster(3, dataNode);

partition.stopDisrupting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ClusterHealthIT extends OpenSearchIntegTestCase {

public void testSimpleLocalHealth() {
createIndex("test");
ensureGreen(); // master should think it's green now.
ensureGreen(); // cluster-manager should think it's green now.

for (final String node : internalCluster().getNodeNames()) {
// a very high time out, which should never fire due to the local flag
Expand Down Expand Up @@ -350,10 +350,10 @@ public void testHealthOnMasterFailover() throws Exception {
final String node = internalCluster().startDataOnlyNode();
final boolean withIndex = randomBoolean();
if (withIndex) {
// Create index with many shards to provoke the health request to wait (for green) while master is being shut down.
// Notice that this is set to 0 after the test completed starting a number of health requests and master restarts.
// Create index with many shards to provoke the health request to wait (for green) while cluster-manager is being shut down.
// Notice that this is set to 0 after the test completed starting a number of health requests and cluster-manager restarts.
// This ensures that the cluster is yellow when the health request is made, making the health request wait on the observer,
// triggering a call to observer.onClusterServiceClose when master is shutdown.
// triggering a call to observer.onClusterServiceClose when cluster-manager is shutdown.
createIndex(
"test",
Settings.builder()
Expand All @@ -364,7 +364,8 @@ public void testHealthOnMasterFailover() throws Exception {
);
}
final List<ActionFuture<ClusterHealthResponse>> responseFutures = new ArrayList<>();
// Run a few health requests concurrent to master fail-overs against a data-node to make sure master failover is handled
// Run a few health requests concurrent to cluster-manager fail-overs against a data-node to make sure cluster-manager failover is
// handled
// without exceptions
final int iterations = withIndex ? 10 : 20;
for (int i = 0; i < iterations; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void testClusterInfoServiceCollectsInformation() {
}
ensureGreen(indexName);
InternalTestCluster internalTestCluster = internalCluster();
// Get the cluster info service on the master node
// Get the cluster info service on the cluster-manager node
final InternalClusterInfoService infoService = (InternalClusterInfoService) internalTestCluster.getInstance(
ClusterInfoService.class,
internalTestCluster.getMasterName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ public void testTwoNodesNoMasterBlock() throws Exception {
);
}

String masterNode = internalCluster().getMasterName();
String otherNode = node1Name.equals(masterNode) ? node2Name : node1Name;
logger.info("--> add voting config exclusion for non-master node, to be sure it's not elected");
String clusterManagerNode = internalCluster().getMasterName();
String otherNode = node1Name.equals(clusterManagerNode) ? node2Name : node1Name;
logger.info("--> add voting config exclusion for non-cluster-manager node, to be sure it's not elected");
client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(otherNode)).get();
logger.info("--> stop master node, no cluster-manager block should appear");
Settings masterDataPathSettings = internalCluster().dataPathSettings(masterNode);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNode));
logger.info("--> stop cluster-manager node, no cluster-manager block should appear");
Settings masterDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNode));

assertBusy(() -> {
ClusterState clusterState = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState();
Expand All @@ -170,7 +170,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {
assertThat(state.nodes().getSize(), equalTo(2));
assertThat(state.nodes().getMasterNode(), equalTo(null));

logger.info("--> starting the previous master node again...");
logger.info("--> starting the previous cluster-manager node again...");
node2Name = internalCluster().startNode(Settings.builder().put(settings).put(masterDataPathSettings).build());

clusterHealthResponse = client().admin()
Expand Down Expand Up @@ -204,11 +204,11 @@ public void testTwoNodesNoMasterBlock() throws Exception {
clearRequest.setWaitForRemoval(false);
client().execute(ClearVotingConfigExclusionsAction.INSTANCE, clearRequest).get();

masterNode = internalCluster().getMasterName();
otherNode = node1Name.equals(masterNode) ? node2Name : node1Name;
logger.info("--> add voting config exclusion for master node, to be sure it's not elected");
client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNode)).get();
logger.info("--> stop non-master node, no cluster-manager block should appear");
clusterManagerNode = internalCluster().getMasterName();
otherNode = node1Name.equals(clusterManagerNode) ? node2Name : node1Name;
logger.info("--> add voting config exclusion for cluster-manager node, to be sure it's not elected");
client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(clusterManagerNode)).get();
logger.info("--> stop non-cluster-manager node, no cluster-manager block should appear");
Settings otherNodeDataPathSettings = internalCluster().dataPathSettings(otherNode);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(otherNode));

Expand All @@ -217,7 +217,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {
assertThat(state1.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID), equalTo(true));
});

logger.info("--> starting the previous master node again...");
logger.info("--> starting the previous cluster-manager node again...");
internalCluster().startNode(Settings.builder().put(settings).put(otherNodeDataPathSettings).build());

ensureGreen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void testNoMasterActions() throws Exception {
}

void checkUpdateAction(boolean autoCreateIndex, TimeValue timeout, ActionRequestBuilder<?, ?> builder) {
// we clean the metadata when loosing a master, therefore all operations on indices will auto create it, if allowed
// we clean the metadata when loosing a cluster-manager, therefore all operations on indices will auto create it, if allowed
try {
builder.get();
fail("expected ClusterBlockException or MasterNotDiscoveredException");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public void testSimpleOnlyMasterNodeElection() throws IOException {
.getMasterNodeId(),
nullValue()
);
fail("should not be able to find master");
fail("should not be able to find cluster-manager");
} catch (MasterNotDiscoveredException e) {
// all is well, no cluster-manager elected
}
logger.info("--> start master node");
logger.info("--> start cluster-manager node");
final String masterNodeName = internalCluster().startClusterManagerOnlyNode();
assertThat(
internalCluster().nonMasterClient()
Expand Down Expand Up @@ -122,12 +122,12 @@ public void testSimpleOnlyMasterNodeElection() throws IOException {
.getMasterNodeId(),
nullValue()
);
fail("should not be able to find master");
fail("should not be able to find cluster-manager");
} catch (MasterNotDiscoveredException e) {
// all is well, no cluster-manager elected
}

logger.info("--> start previous master node again");
logger.info("--> start previous cluster-manager node again");
final String nextMasterEligibleNodeName = internalCluster().startNode(
Settings.builder().put(nonDataNode(masterNode())).put(masterDataPathSettings)
);
Expand Down Expand Up @@ -161,7 +161,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException {

public void testElectOnlyBetweenMasterNodes() throws Exception {
internalCluster().setBootstrapClusterManagerNodeIndex(0);
logger.info("--> start data node / non master node");
logger.info("--> start data node / non cluster-manager node");
internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s"));
try {
assertThat(
Expand All @@ -176,11 +176,11 @@ public void testElectOnlyBetweenMasterNodes() throws Exception {
.getMasterNodeId(),
nullValue()
);
fail("should not be able to find master");
fail("should not be able to find cluster-manager");
} catch (MasterNotDiscoveredException e) {
// all is well, no cluster-manager elected
}
logger.info("--> start master node (1)");
logger.info("--> start cluster-manager node (1)");
final String masterNodeName = internalCluster().startClusterManagerOnlyNode();
assertThat(
internalCluster().nonMasterClient()
Expand Down Expand Up @@ -209,7 +209,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception {
equalTo(masterNodeName)
);

logger.info("--> start master node (2)");
logger.info("--> start cluster-manager node (2)");
final String nextMasterEligableNodeName = internalCluster().startClusterManagerOnlyNode();
assertThat(
internalCluster().nonMasterClient()
Expand Down Expand Up @@ -253,7 +253,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception {

logger.info("--> closing master node (1)");
client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNodeName)).get();
// removing the master from the voting configuration immediately triggers the master to step down
// removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down
assertBusy(() -> {
assertThat(
internalCluster().nonMasterClient()
Expand Down Expand Up @@ -313,10 +313,10 @@ public void testElectOnlyBetweenMasterNodes() throws Exception {

public void testAliasFilterValidation() {
internalCluster().setBootstrapClusterManagerNodeIndex(0);
logger.info("--> start master node / non data");
logger.info("--> start cluster-manager node / non data");
internalCluster().startClusterManagerOnlyNode();

logger.info("--> start data node / non master node");
logger.info("--> start data node / non cluster-manager node");
internalCluster().startDataOnlyNode();

assertAcked(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void testFollowupRerouteCanBeSetToHigherPriority() {
.setPersistentSettings(Settings.builder().put(ShardStateAction.FOLLOW_UP_REROUTE_PRIORITY_SETTING.getKey(), "urgent"))
);

// ensure that the master always has a HIGH priority pending task
// ensure that the cluster-manager always has a HIGH priority pending task
final AtomicBoolean stopSpammingMaster = new AtomicBoolean();
final ClusterService masterClusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName());
masterClusterService.submitStateUpdateTask("spam", new ClusterStateUpdateTask(Priority.HIGH) {
Expand All @@ -141,7 +141,8 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
}
});

// even with the master under such pressure, all shards of the index can be assigned; in particular, after the primaries have
// even with the cluster-manager under such pressure, all shards of the index can be assigned; in particular, after the primaries
// have
// started there's a follow-up reroute at a higher priority than the spam
createIndex("test");
assertFalse(client().admin().cluster().prepareHealth().setWaitForGreenStatus().get().isTimedOut());
Expand Down
Loading

0 comments on commit 8cb690c

Please sign in to comment.