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 and deprecate public methods that contains 'master' in the name in 'server' directory #3647

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 @@ -123,7 +123,7 @@ public void testReindexFromRemote() throws Exception {
*/
NodeInfo clusterManagerNode = null;
for (NodeInfo candidate : client.admin().cluster().prepareNodesInfo().get().getNodes()) {
if (candidate.getNode().isMasterNode()) {
if (candidate.getNode().isClusterManagerNode()) {
clusterManagerNode = candidate;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testOneNodeShouldRunUsingPrivateIp() {
final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getClusterManagerNodeId()
);

// We expect having 1 node as part of the cluster, let's test that
Expand All @@ -66,7 +66,7 @@ public void testOneNodeShouldRunUsingPublicIp() {
final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getClusterManagerNodeId()
);

// We expect having 1 node as part of the cluster, let's test that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public void testTwoNodesShouldRunUsingPrivateOrPublicIp() {
final String node1 = internalCluster().startNode(settings);
registerAzureNode(node1);
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getClusterManagerNodeId()
);

logger.info("--> start another node");
final String node2 = internalCluster().startNode(settings);
registerAzureNode(node2);
assertNotNull(
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getMasterNodeId()
client().admin().cluster().prepareState().setClusterManagerNodeTimeout("1s").get().getState().nodes().getClusterManagerNodeId()
);

// We expect having 2 nodes as part of the cluster, let's test that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testJoin() {
.clear()
.setNodes(true)
.get();
assertNotNull(clusterStateResponse.getState().nodes().getMasterNodeId());
assertNotNull(clusterStateResponse.getState().nodes().getClusterManagerNodeId());

// start another node
final String secondNode = internalCluster().startNode();
Expand All @@ -109,7 +109,7 @@ public void testJoin() {
.setNodes(true)
.setLocal(true)
.get();
assertNotNull(clusterStateResponse.getState().nodes().getMasterNodeId());
assertNotNull(clusterStateResponse.getState().nodes().getClusterManagerNodeId());

// wait for the cluster to form
assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(2)).get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public void testNonLocalRequestAlwaysFindsClusterManager() throws Exception {
} catch (ClusterManagerNotDiscoveredException e) {
return; // ok, we hit the disconnected node
}
assertNotNull("should always contain a cluster-manager node", clusterStateResponse.getState().nodes().getMasterNodeId());
assertNotNull(
"should always contain a cluster-manager node",
clusterStateResponse.getState().nodes().getClusterManagerNodeId()
);
});
}

Expand Down Expand Up @@ -134,7 +137,7 @@ public void testNonLocalRequestAlwaysFindsClusterManagerAndWaitsForMetadata() th
}
if (clusterStateResponse.isWaitForTimedOut() == false) {
final ClusterState state = clusterStateResponse.getState();
assertNotNull("should always contain a cluster-manager node", state.nodes().getMasterNodeId());
assertNotNull("should always contain a cluster-manager node", state.nodes().getClusterManagerNodeId());
assertThat("waited for metadata version", state.metadata().version(), greaterThanOrEqualTo(waitForMetadataVersion));
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void testTwoNodesNoClusterManagerBlock() throws Exception {
assertThat(state.blocks().hasGlobalBlockWithId(NoClusterManagerBlockService.NO_MASTER_BLOCK_ID), equalTo(true));
// 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));
assertThat(state.nodes().getClusterManagerNode(), equalTo(null));

logger.info("--> starting the previous cluster-manager node again...");
node2Name = internalCluster().startNode(Settings.builder().put(settings).put(clusterManagerDataPathSettings).build());
Expand Down Expand Up @@ -387,7 +387,7 @@ public void onFailure(String source, Exception e) {
assertThat(failure.get(), instanceOf(FailedToCommitClusterStateException.class));

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

// let major partition to elect new cluster-manager, to ensure that old cluster-manager is not elected once partition is restored,
// otherwise persistent setting (which is a part of accepted state on old cluster-manager) will be propagated to other nodes
Expand All @@ -401,7 +401,7 @@ public void onFailure(String source, Exception e) {
.actionGet()
.getState()
.nodes()
.getMasterNode();
.getClusterManagerNode();
assertThat(clusterManagerNode, notNullValue());
assertThat(clusterManagerNode.getName(), not(equalTo(clusterManager)));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public Collection<Object> createComponents(
return;
}

if (state.nodes().isLocalNodeElectedMaster()) {
if (state.nodes().isLocalNodeElectedClusterManager()) {
if (state.custom("test") == null) {
if (installed.compareAndSet(false, true)) {
clusterService.submitStateUpdateTask("install-metadata-custom", new ClusterStateUpdateTask(Priority.URGENT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNodeId(),
.getClusterManagerNodeId(),
nullValue()
);
fail("should not be able to find cluster-manager");
Expand All @@ -87,7 +87,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -100,7 +100,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -119,7 +119,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNodeId(),
.getClusterManagerNodeId(),
nullValue()
);
fail("should not be able to find cluster-manager");
Expand All @@ -140,7 +140,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligibleNodeName)
);
Expand All @@ -153,7 +153,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligibleNodeName)
);
Expand All @@ -173,7 +173,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNodeId(),
.getClusterManagerNodeId(),
nullValue()
);
fail("should not be able to find cluster-manager");
Expand All @@ -191,7 +191,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -204,7 +204,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -220,7 +220,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -233,7 +233,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -246,7 +246,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(clusterManagerNodeName)
);
Expand All @@ -264,7 +264,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligableNodeName)
);
Expand All @@ -277,7 +277,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligableNodeName)
);
Expand All @@ -292,7 +292,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligableNodeName)
);
Expand All @@ -305,7 +305,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
.actionGet()
.getState()
.nodes()
.getMasterNode()
.getClusterManagerNode()
.getName(),
equalTo(nextClusterManagerEligableNodeName)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ public void testDelayedMappingPropagationOnPrimary() throws Exception {

// Check routing tables
ClusterState state = client().admin().cluster().prepareState().get().getState();
assertEquals(clusterManager, state.nodes().getMasterNode().getName());
assertEquals(clusterManager, state.nodes().getClusterManagerNode().getName());
List<ShardRouting> shards = state.routingTable().allShards("index");
assertThat(shards, hasSize(1));
for (ShardRouting shard : shards) {
if (shard.primary()) {
// primary must not be on the cluster-manager node
assertFalse(state.nodes().getMasterNodeId().equals(shard.currentNodeId()));
assertFalse(state.nodes().getClusterManagerNodeId().equals(shard.currentNodeId()));
} else {
fail(); // only primaries
}
Expand Down Expand Up @@ -336,13 +336,13 @@ public void testDelayedMappingPropagationOnReplica() throws Exception {

// Check routing tables
ClusterState state = client().admin().cluster().prepareState().get().getState();
assertEquals(clusterManager, state.nodes().getMasterNode().getName());
assertEquals(clusterManager, state.nodes().getClusterManagerNode().getName());
List<ShardRouting> shards = state.routingTable().allShards("index");
assertThat(shards, hasSize(2));
for (ShardRouting shard : shards) {
if (shard.primary()) {
// primary must be on the cluster-manager
assertEquals(state.nodes().getMasterNodeId(), shard.currentNodeId());
assertEquals(state.nodes().getClusterManagerNodeId(), shard.currentNodeId());
} else {
assertTrue(shard.active());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void testElectsNodeNotInVotingConfiguration() throws Exception {
final Set<String> votingConfiguration = clusterState.getLastCommittedConfiguration().getNodeIds();
assertThat(votingConfiguration, hasSize(3));
assertThat(clusterState.nodes().getSize(), equalTo(4));
assertThat(votingConfiguration, hasItem(clusterState.nodes().getMasterNodeId()));
assertThat(votingConfiguration, hasItem(clusterState.nodes().getClusterManagerNodeId()));
for (DiscoveryNode discoveryNode : clusterState.nodes()) {
if (votingConfiguration.contains(discoveryNode.getId()) == false) {
assertThat(excludedNodeName, nullValue());
Expand Down Expand Up @@ -155,7 +155,10 @@ public void testElectsNodeNotInVotingConfiguration() throws Exception {
.setMetadata(true)
.get()
.getState();
assertThat(newClusterState.nodes().getMasterNode().getName(), equalTo(excludedNodeName));
assertThat(newClusterState.getLastCommittedConfiguration().getNodeIds(), hasItem(newClusterState.nodes().getMasterNodeId()));
assertThat(newClusterState.nodes().getClusterManagerNode().getName(), equalTo(excludedNodeName));
assertThat(
newClusterState.getLastCommittedConfiguration().getNodeIds(),
hasItem(newClusterState.nodes().getClusterManagerNodeId())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ public void testIsolateClusterManagerAndVerifyClusterStateConsensus() throws Exc
try {
assertEquals("unequal versions", state.version(), nodeState.version());
assertEquals("unequal node count", state.nodes().getSize(), nodeState.nodes().getSize());
assertEquals("different cluster-managers ", state.nodes().getMasterNodeId(), nodeState.nodes().getMasterNodeId());
assertEquals(
"different cluster-managers ",
state.nodes().getClusterManagerNodeId(),
nodeState.nodes().getClusterManagerNodeId()
);
assertEquals("different meta data version", state.metadata().version(), nodeState.metadata().version());
assertEquals("different routing", state.routingTable().toString(), nodeState.routingTable().toString());
} catch (AssertionError t) {
Expand Down Expand Up @@ -238,7 +242,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception {
for (String node : partitions.getMajoritySide()) {
ClusterState nodeState = getNodeClusterState(node);
boolean success = true;
if (nodeState.nodes().getMasterNode() == null) {
if (nodeState.nodes().getClusterManagerNode() == null) {
success = false;
}
if (!nodeState.blocks().global().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception {

TransportService clusterManagerTranspotService = internalCluster().getInstance(
TransportService.class,
discoveryNodes.getMasterNode().getName()
discoveryNodes.getClusterManagerNode().getName()
);

logger.info("blocking requests from non cluster-manager [{}] to cluster-manager [{}]", nonClusterManagerNode, clusterManagerNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void testFailWithMinimumClusterManagerNodesConfigured() throws Exception
private void ensureNoMaster(String node) throws Exception {
assertBusy(
() -> assertNull(
client(node).admin().cluster().state(new ClusterStateRequest().local(true)).get().getState().nodes().getMasterNode()
client(node).admin().cluster().state(new ClusterStateRequest().local(true)).get().getState().nodes().getClusterManagerNode()
)
);
}
Expand Down Expand Up @@ -220,8 +220,8 @@ public void testStaleClusterManagerNotHijackingMajority() throws Exception {
for (final String node : majoritySide) {
clusterManagers.put(node, new ArrayList<>());
internalCluster().getInstance(ClusterService.class, node).addListener(event -> {
DiscoveryNode previousClusterManager = event.previousState().nodes().getMasterNode();
DiscoveryNode currentClusterManager = event.state().nodes().getMasterNode();
DiscoveryNode previousClusterManager = event.previousState().nodes().getClusterManagerNode();
DiscoveryNode currentClusterManager = event.state().nodes().getClusterManagerNode();
if (!Objects.equals(previousClusterManager, currentClusterManager)) {
logger.info(
"--> node {} received new cluster state: {} \n and had previous cluster state: {}",
Expand All @@ -238,7 +238,7 @@ public void testStaleClusterManagerNotHijackingMajority() throws Exception {

final CountDownLatch oldClusterManagerNodeSteppedDown = new CountDownLatch(1);
internalCluster().getInstance(ClusterService.class, oldClusterManagerNode).addListener(event -> {
if (event.state().nodes().getMasterNodeId() == null) {
if (event.state().nodes().getClusterManagerNodeId() == null) {
oldClusterManagerNodeSteppedDown.countDown();
}
});
Expand Down
Loading