[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:
Shay Banon 2014-04-11 17:24:32 +02:00 committed by Boaz Leskes
parent 4824f05369
commit 6ede83ab45
1 changed files with 8 additions and 0 deletions

View File

@ -119,6 +119,8 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
private final AtomicBoolean initialStateSent = new AtomicBoolean();
private final boolean rejoinOnMasterGone;
@Nullable
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.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);
@ -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
.remove(masterNode.id())
.masterNodeId(null).build();
latestDiscoNodes = discoveryNodes;
if (rejoinOnMasterGone) {
return rejoin(ClusterState.builder(currentState).nodes(discoveryNodes).build(), "master left (reason = " + reason + ")");
}
if (!electMaster.hasEnoughMasterNodes(discoveryNodes)) {
return rejoin(ClusterState.builder(currentState).nodes(discoveryNodes).build(), "not enough master nodes after master left (reason = " + reason + ")");