From 1849d0966c2e6a23db339d5a02aa975377e882ba Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 11 Jun 2014 20:48:35 +0200 Subject: [PATCH] [Discovery] Made 'discovery.zen.rejoin_on_master_gone' setting updatable at runtime. --- .../elasticsearch/discovery/zen/ZenDiscovery.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java b/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java index 50f5747243a..8ccd5046e24 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java +++ b/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java @@ -76,6 +76,8 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; */ public class ZenDiscovery extends AbstractLifecycleComponent 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; @@ -117,7 +119,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent implemen private final AtomicBoolean initialStateSent = new AtomicBoolean(); - private final boolean rejoinOnMasterGone; + private volatile boolean rejoinOnMasterGone; @Nullable @@ -144,7 +146,7 @@ public class ZenDiscovery extends AbstractLifecycleComponent 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", 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); @@ -1015,6 +1017,12 @@ public class ZenDiscovery extends AbstractLifecycleComponent implemen 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; + } } } }