Skip to content

Remove initial_master_nodes on node restart #37580

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

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 @@ -22,7 +22,6 @@
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
Expand Down Expand Up @@ -66,11 +65,6 @@ public void testQuorumRecovery() throws Exception {
}
logger.info("--> restart all nodes");
internalCluster().fullRestart(new RestartCallback() {
@Override
public Settings onNodeStopped(String nodeName) throws Exception {
return null;
}

@Override
public void doAfterNodes(int numNodes, final Client activeClient) throws Exception {
if (numNodes == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,7 @@ public void testRestoreIndexWithShardsMissingInLocalGateway() throws Exception {
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
.build();

internalCluster().startNode(nodeSettings);
internalCluster().startNode(nodeSettings);
internalCluster().startNodes(2, nodeSettings);
cluster().wipeIndices("_all");

logger.info("--> create repository");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,15 @@ Settings closeForRestart(RestartCallback callback, int minMasterNodes) throws Ex
assert callback != null;
close();
Settings callbackSettings = callback.onNodeStopped(name);
assert callbackSettings != null;
Settings.Builder newSettings = Settings.builder();
if (callbackSettings != null) {
newSettings.put(callbackSettings);
}
newSettings.put(callbackSettings);
if (minMasterNodes >= 0) {
assert DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.exists(newSettings.build()) == false : "min master nodes is auto managed";
newSettings.put(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), minMasterNodes).build();
newSettings.put(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), minMasterNodes);
if (INITIAL_MASTER_NODES_SETTING.exists(callbackSettings) == false) {
newSettings.putList(INITIAL_MASTER_NODES_SETTING.getKey());
}
}
// delete data folders now, before we start other nodes that may claim it
clearDataIfNeeded(callback);
Expand Down Expand Up @@ -1691,12 +1693,7 @@ public synchronized void restartNode(String nodeName, RestartCallback callback)
}
}

public static final RestartCallback EMPTY_CALLBACK = new RestartCallback() {
@Override
public Settings onNodeStopped(String node) {
return null;
}
};
public static final RestartCallback EMPTY_CALLBACK = new RestartCallback();

/**
* Restarts all nodes in the cluster. It first stops all nodes and then restarts all the nodes again.
Expand Down