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.
This commit is contained in:
parent
ab871add36
commit
bd603b0a7b
|
@ -95,16 +95,8 @@ public class ClusterRebalanceAllocationDecider extends AllocationDecider {
|
||||||
private volatile ClusterRebalanceType type;
|
private volatile ClusterRebalanceType type;
|
||||||
|
|
||||||
public ClusterRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
public ClusterRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||||
try {
|
|
||||||
type = CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.get(settings);
|
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;
|
|
||||||
}
|
|
||||||
logger.debug("using [{}] with [{}]", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, type);
|
logger.debug("using [{}] with [{}]", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, type);
|
||||||
|
|
||||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, this::setType);
|
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, this::setType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue