From bd603b0a7ba4aecf9a7c8f4bca849063eaf75735 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sat, 28 Sep 2019 08:04:36 -0400 Subject: [PATCH] Remove dead leniency in allow rebalance setting use (#47259) This commit removes some leniency that exists in getting the allow rebalance setting. Fortunately, that leniency is dead code, this can never happen. The reason this can never happen is because the settings infrastructure will not allow setting an invalid value for this setting. If you try to set this in the elasticsearch.yml, then the node will fail to start, since parsing the setting will fail. If you try to set this via an update settings API call, then parsing the setting will fail and the settings update will be rejected. Therefore, this leniency can never be activated, so we remove it. This commit is the first of a few in an attempt to remove the public uses of Setting#getRaw. --- .../decider/ClusterRebalanceAllocationDecider.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ClusterRebalanceAllocationDecider.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ClusterRebalanceAllocationDecider.java index 4d309dd9728..fef6adf4414 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ClusterRebalanceAllocationDecider.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ClusterRebalanceAllocationDecider.java @@ -95,16 +95,8 @@ public class ClusterRebalanceAllocationDecider extends AllocationDecider { private volatile ClusterRebalanceType type; public ClusterRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) { - try { - type = CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.get(settings); - } catch (IllegalStateException e) { - logger.warn("[{}] has a wrong value {}, defaulting to 'indices_all_active'", - CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, - CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getRaw(settings)); - type = ClusterRebalanceType.INDICES_ALL_ACTIVE; - } + type = CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.get(settings); logger.debug("using [{}] with [{}]", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, type); - clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, this::setType); }