Skip to content

Commit

Permalink
[Discovery] Made 'discovery.zen.rejoin_on_master_gone' setting updata…
Browse files Browse the repository at this point in the history
…ble at runtime.
  • Loading branch information
martijnvg authored and bleskes committed Aug 27, 2014
1 parent 424a2f6 commit 1849d09
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
*/
public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implements Discovery, DiscoveryNodesProvider {

private final static String REJOIN_ON_MASTER_GONE = "discovery.zen.rejoin_on_master_gone";

public static final String DISCOVERY_REJOIN_ACTION_NAME = "internal:discovery/zen/rejoin";

private final ThreadPool threadPool;
Expand Down Expand Up @@ -117,7 +119,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen

private final AtomicBoolean initialStateSent = new AtomicBoolean();

private final boolean rejoinOnMasterGone;
private volatile boolean rejoinOnMasterGone;


@Nullable
Expand All @@ -144,7 +146,7 @@ public ZenDiscovery(Settings settings, ClusterName clusterName, ThreadPool threa

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", true);
this.rejoinOnMasterGone = settings.getAsBoolean(REJOIN_ON_MASTER_GONE, true);

logger.debug("using ping.timeout [{}], join.timeout [{}], master_election.filter_client [{}], master_election.filter_data [{}]", pingTimeout, joinTimeout, masterElectionFilterClientNodes, masterElectionFilterDataNodes);

Expand Down Expand Up @@ -1015,6 +1017,12 @@ public void onRefreshSettings(Settings settings) {
ZenDiscovery.this.electMaster.minimumMasterNodes(), minimumMasterNodes);
handleMinimumMasterNodesChanged(minimumMasterNodes);
}

boolean rejoinOnMasterGone = settings.getAsBoolean(REJOIN_ON_MASTER_GONE, ZenDiscovery.this.rejoinOnMasterGone);
if (rejoinOnMasterGone != ZenDiscovery.this.rejoinOnMasterGone) {
logger.info("updating {} from [{}] to [{}]", REJOIN_ON_MASTER_GONE, ZenDiscovery.this.rejoinOnMasterGone, rejoinOnMasterGone);
ZenDiscovery.this.rejoinOnMasterGone = rejoinOnMasterGone;
}
}
}
}

0 comments on commit 1849d09

Please sign in to comment.