Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ClusterBlock description 'no master' to 'no cluster-manager' #3133

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {
logger.info("--> start first node");
String node1Name = internalCluster().startNode(settings);

logger.info("--> should be blocked, no master...");
logger.info("--> should be blocked, no cluster-manager...");
ClusterState state = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState();
assertThat(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID), equalTo(true));
assertThat(state.nodes().getSize(), equalTo(1)); // verify that we still see the local node in the cluster state
Expand Down Expand Up @@ -155,7 +155,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {
String otherNode = node1Name.equals(masterNode) ? node2Name : node1Name;
logger.info("--> add voting config exclusion for non-master node, to be sure it's not elected");
client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(otherNode)).get();
logger.info("--> stop master node, no master block should appear");
logger.info("--> stop master node, no cluster-manager block should appear");
Settings masterDataPathSettings = internalCluster().dataPathSettings(masterNode);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNode));

Expand All @@ -166,7 +166,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {

state = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState();
assertThat(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID), equalTo(true));
// verify that both nodes are still in the cluster state but there is no master
// verify that both nodes are still in the cluster state but there is no cluster-manager
assertThat(state.nodes().getSize(), equalTo(2));
assertThat(state.nodes().getMasterNode(), equalTo(null));

Expand Down Expand Up @@ -208,7 +208,7 @@ public void testTwoNodesNoMasterBlock() throws Exception {
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 master block should appear");
logger.info("--> stop non-master node, no cluster-manager block should appear");
Settings otherNodeDataPathSettings = internalCluster().dataPathSettings(otherNode);
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(otherNode));

Expand Down Expand Up @@ -317,7 +317,7 @@ public void testThreeNodesNoMasterBlock() throws Exception {
internalCluster().stopRandomNonMasterNode();
internalCluster().stopRandomNonMasterNode();

logger.info("--> verify that there is no master anymore on remaining node");
logger.info("--> verify that there is no cluster-manager anymore on remaining node");
// spin here to wait till the state is set
assertBusy(() -> {
ClusterState st = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState();
Expand Down Expand Up @@ -386,7 +386,7 @@ public void onFailure(String source, Exception e) {

assertThat(failure.get(), instanceOf(FailedToCommitClusterStateException.class));

logger.debug("--> check that there is no master in minor partition");
logger.debug("--> check that there is no cluster-manager in minor partition");
assertBusy(() -> assertThat(masterClusterService.state().nodes().getMasterNode(), nullValue()));

// let major partition to elect new master, to ensure that old master is not elected once partition is restored,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException {
);
fail("should not be able to find master");
} catch (MasterNotDiscoveredException e) {
// all is well, no master elected
// all is well, no cluster-manager elected
}
logger.info("--> start master node");
final String masterNodeName = internalCluster().startMasterOnlyNode();
Expand Down Expand Up @@ -124,7 +124,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException {
);
fail("should not be able to find master");
} catch (MasterNotDiscoveredException e) {
// all is well, no master elected
// all is well, no cluster-manager elected
}

logger.info("--> start previous master node again");
Expand Down Expand Up @@ -178,7 +178,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception {
);
fail("should not be able to find master");
} catch (MasterNotDiscoveredException e) {
// all is well, no master elected
// all is well, no cluster-manager elected
}
logger.info("--> start master node (1)");
final String masterNodeName = internalCluster().startMasterOnlyNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void testNodeNotReachableFromMaster() throws Exception {
logger.info("waiting for [{}] to be removed from cluster", nonMasterNode);
ensureStableCluster(2, masterNode);

logger.info("waiting for [{}] to have no master", nonMasterNode);
logger.info("waiting for [{}] to have no cluster-manager", nonMasterNode);
assertNoMaster(nonMasterNode);

logger.info("healing partition and checking cluster reforms");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception {
// The unlucky node must report *no* master node, since it can't connect to master and in fact it should
// continuously ping until network failures have been resolved. However
// It may a take a bit before the node detects it has been cut off from the elected master
logger.info("waiting for isolated node [{}] to have no master", isolatedNode);
logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode);
assertNoMaster(isolatedNode, NoMasterBlockService.NO_MASTER_BLOCK_WRITES, TimeValue.timeValueSeconds(30));

logger.info("wait until elected master has been removed and a new 2 node cluster was from (via [{}])", isolatedNode);
Expand All @@ -236,7 +236,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception {
fail(
"node ["
+ node
+ "] has no master or has blocks, despite of being on the right side of the partition. State dump:\n"
+ "] has no cluster-manager or has blocks, despite of being on the right side of the partition. State dump:\n"
+ nodeState
);
}
Expand All @@ -247,7 +247,11 @@ public void testVerifyApiBlocksDuringPartition() throws Exception {
// Wait until the master node sees al 3 nodes again.
ensureStableCluster(3, new TimeValue(DISRUPTION_HEALING_OVERHEAD.millis() + networkDisruption.expectedTimeToHeal().millis()));

logger.info("Verify no master block with {} set to {}", NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(), "all");
logger.info(
"Verify no cluster-manager block with {} set to {}",
NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(),
"all"
);
client().admin()
.cluster()
.prepareUpdateSettings()
Expand All @@ -259,7 +263,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception {
// The unlucky node must report *no* master node, since it can't connect to master and in fact it should
// continuously ping until network failures have been resolved. However
// It may a take a bit before the node detects it has been cut off from the elected master
logger.info("waiting for isolated node [{}] to have no master", isolatedNode);
logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode);
assertNoMaster(isolatedNode, NoMasterBlockService.NO_MASTER_BLOCK_ALL, TimeValue.timeValueSeconds(30));

// make sure we have stable cluster & cross partition recoveries are canceled by the removal of the missing node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class NoMasterBlockService {
public static final int NO_MASTER_BLOCK_ID = 2;
public static final ClusterBlock NO_MASTER_BLOCK_WRITES = new ClusterBlock(
NO_MASTER_BLOCK_ID,
"no master",
"no cluster-manager",
true,
false,
false,
Expand All @@ -54,7 +54,7 @@ public class NoMasterBlockService {
);
public static final ClusterBlock NO_MASTER_BLOCK_ALL = new ClusterBlock(
NO_MASTER_BLOCK_ID,
"no master",
"no cluster-manager",
true,
true,
false,
Expand All @@ -63,7 +63,7 @@ public class NoMasterBlockService {
);
public static final ClusterBlock NO_MASTER_BLOCK_METADATA_WRITES = new ClusterBlock(
NO_MASTER_BLOCK_ID,
"no master",
"no cluster-manager",
true,
false,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public interface SeedHostsProvider {

/**
* Returns a list of seed hosts to use for discovery. Called repeatedly while discovery is active (i.e. while there is no master)
* Returns a list of seed hosts to use for discovery. Called repeatedly while discovery is active (i.e. while there is no cluster-manager)
* so that this list may be dynamic.
*/
List<TransportAddress> getSeedAddresses(HostsResolver hostsResolver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public void testFailedNodeException() throws IOException {

public void testClusterBlockException() throws IOException {
ClusterBlockException ex = serialize(new ClusterBlockException(singleton(NoMasterBlockService.NO_MASTER_BLOCK_WRITES)));
assertEquals("blocked by: [SERVICE_UNAVAILABLE/2/no master];", ex.getMessage());
assertEquals("blocked by: [SERVICE_UNAVAILABLE/2/no cluster-manager];", ex.getMessage());
assertTrue(ex.blocks().contains(NoMasterBlockService.NO_MASTER_BLOCK_WRITES));
assertEquals(1, ex.blocks().size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public void testToXContentWithHeadersAndMetadata() throws IOException {
+ "\"reason\":\"baz\","
+ "\"caused_by\":{"
+ "\"type\":\"cluster_block_exception\","
+ "\"reason\":\"blocked by: [SERVICE_UNAVAILABLE/2/no master];\""
+ "\"reason\":\"blocked by: [SERVICE_UNAVAILABLE/2/no cluster-manager];\""
+ "}"
+ "}"
+ "},"
Expand Down Expand Up @@ -537,7 +537,7 @@ public void testToXContentWithHeadersAndMetadata() throws IOException {
cause = (OpenSearchException) cause.getCause();
assertEquals(
cause.getMessage(),
"OpenSearch exception [type=cluster_block_exception, reason=blocked by: [SERVICE_UNAVAILABLE/2/no master];]"
"OpenSearch exception [type=cluster_block_exception, reason=blocked by: [SERVICE_UNAVAILABLE/2/no cluster-manager];]"
);
}

Expand Down Expand Up @@ -1034,7 +1034,8 @@ public static Tuple<Throwable, OpenSearchException> randomExceptions() {
case 0:
actual = new ClusterBlockException(singleton(NoMasterBlockService.NO_MASTER_BLOCK_WRITES));
expected = new OpenSearchException(
"OpenSearch exception [type=cluster_block_exception, " + "reason=blocked by: [SERVICE_UNAVAILABLE/2/no master];]"
"OpenSearch exception [type=cluster_block_exception, "
+ "reason=blocked by: [SERVICE_UNAVAILABLE/2/no cluster-manager];]"
);
break;
case 1: // Simple opensearch exception with headers (other metadata of type number are not parsed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void testSupersedes() {
.nodes(DiscoveryNodes.builder(nodes).masterNodeId(node2.getId()))
.build();

// states with no master should never supersede anything
// states with no cluster-manager should never supersede anything
assertFalse(noMaster1.supersedes(noMaster2));
assertFalse(noMaster1.supersedes(withMaster1a));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public static ClusterState stateWithNoShard() {
* Creates a cluster state where local node and master node can be specified
*
* @param localNode node in allNodes that is the local node
* @param masterNode node in allNodes that is the master node. Can be null if no master exists
* @param masterNode node in allNodes that is the master node. Can be null if no cluster-manager exists
* @param allNodes all nodes in the cluster
* @return cluster state
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,11 @@ void stabilise(long stabilisationDurationMillis) {
);
} else {
assertThat(nodeId + " is not following " + leaderId, clusterNode.coordinator.getMode(), is(CANDIDATE));
assertThat(nodeId + " has no master", clusterNode.getLastAppliedClusterState().nodes().getMasterNode(), nullValue());
assertThat(
nodeId + " has no cluster-manager",
clusterNode.getLastAppliedClusterState().nodes().getMasterNode(),
nullValue()
);
assertThat(
nodeId + " has NO_MASTER_BLOCK",
clusterNode.getLastAppliedClusterState().blocks().hasGlobalBlockWithId(NO_MASTER_BLOCK_ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ public Client masterClient() {
if (randomNodeAndClient != null) {
return randomNodeAndClient.nodeClient(); // ensure node client master is requested
}
throw new AssertionError("No master client found");
throw new AssertionError("No cluster-manager client found");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ private static Tuple<Failure, Failure> randomShardInfoFailure(Random random) {
case 0:
actualException = new ClusterBlockException(singleton(NoMasterBlockService.NO_MASTER_BLOCK_WRITES));
expectedException = new OpenSearchException(
"OpenSearch exception [type=cluster_block_exception, " + "reason=blocked by: [SERVICE_UNAVAILABLE/2/no master];]"
"OpenSearch exception [type=cluster_block_exception, "
+ "reason=blocked by: [SERVICE_UNAVAILABLE/2/no cluster-manager];]"
);
break;
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public Path nodeConfigPath(int nodeOrdinal) {
List<DiscoveryNodeRole> roles = new ArrayList<>();
for (int i = 0; i < numNodes; i++) {
final DiscoveryNodeRole role = i == numNodes - 1 && roles.contains(clusterManagerRole) == false
? clusterManagerRole // last node and still no master
? clusterManagerRole // last node and still no cluster-manager
: randomFrom(clusterManagerRole, DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.INGEST_ROLE);
roles.add(role);
}
Expand Down