[Discovery] add rejoin on master gone flag, defaults to false
defaults to false since there is still work left to properly make it work
This commit is contained in:
parent
4824f05369
commit
6ede83ab45
|
@ -119,6 +119,8 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
||||||
|
|
||||||
private final AtomicBoolean initialStateSent = new AtomicBoolean();
|
private final AtomicBoolean initialStateSent = new AtomicBoolean();
|
||||||
|
|
||||||
|
private final boolean rejoinOnMasterGone;
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
@ -144,6 +146,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
||||||
|
|
||||||
this.masterElectionFilterClientNodes = settings.getAsBoolean("discovery.zen.master_election.filter_client", true);
|
this.masterElectionFilterClientNodes = settings.getAsBoolean("discovery.zen.master_election.filter_client", true);
|
||||||
this.masterElectionFilterDataNodes = settings.getAsBoolean("discovery.zen.master_election.filter_data", false);
|
this.masterElectionFilterDataNodes = settings.getAsBoolean("discovery.zen.master_election.filter_data", false);
|
||||||
|
this.rejoinOnMasterGone = settings.getAsBoolean("discovery.zen.rejoin_on_master_gone", false);
|
||||||
|
|
||||||
logger.debug("using ping.timeout [{}], join.timeout [{}], master_election.filter_client [{}], master_election.filter_data [{}]", pingTimeout, joinTimeout, masterElectionFilterClientNodes, masterElectionFilterDataNodes);
|
logger.debug("using ping.timeout [{}], join.timeout [{}], master_election.filter_client [{}], master_election.filter_data [{}]", pingTimeout, joinTimeout, masterElectionFilterClientNodes, masterElectionFilterDataNodes);
|
||||||
|
|
||||||
|
@ -495,6 +498,11 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
|
||||||
// make sure the old master node, which has failed, is not part of the nodes we publish
|
// make sure the old master node, which has failed, is not part of the nodes we publish
|
||||||
.remove(masterNode.id())
|
.remove(masterNode.id())
|
||||||
.masterNodeId(null).build();
|
.masterNodeId(null).build();
|
||||||
|
latestDiscoNodes = discoveryNodes;
|
||||||
|
|
||||||
|
if (rejoinOnMasterGone) {
|
||||||
|
return rejoin(ClusterState.builder(currentState).nodes(discoveryNodes).build(), "master left (reason = " + reason + ")");
|
||||||
|
}
|
||||||
|
|
||||||
if (!electMaster.hasEnoughMasterNodes(discoveryNodes)) {
|
if (!electMaster.hasEnoughMasterNodes(discoveryNodes)) {
|
||||||
return rejoin(ClusterState.builder(currentState).nodes(discoveryNodes).build(), "not enough master nodes after master left (reason = " + reason + ")");
|
return rejoin(ClusterState.builder(currentState).nodes(discoveryNodes).build(), "not enough master nodes after master left (reason = " + reason + ")");
|
||||||
|
|
Loading…
Reference in New Issue