Remove cluster.routing.allocation.snapshot.relocation_enabled setting

This experimental setting enables relocation of shards that are being snapshotted, which can cause the shard allocation failures. This setting is undocumented and there is no good reason to set it in production.
This commit is contained in:
Igor Motov 2016-10-18 10:36:32 -04:00
parent f51bf8ee47
commit 441320b734
3 changed files with 2 additions and 33 deletions

View File

@ -114,7 +114,7 @@ public class ClusterModule extends AbstractModule {
addAllocationDecider(deciders, new ConcurrentRebalanceAllocationDecider(settings, clusterSettings)); addAllocationDecider(deciders, new ConcurrentRebalanceAllocationDecider(settings, clusterSettings));
addAllocationDecider(deciders, new EnableAllocationDecider(settings, clusterSettings)); addAllocationDecider(deciders, new EnableAllocationDecider(settings, clusterSettings));
addAllocationDecider(deciders, new NodeVersionAllocationDecider(settings)); addAllocationDecider(deciders, new NodeVersionAllocationDecider(settings));
addAllocationDecider(deciders, new SnapshotInProgressAllocationDecider(settings, clusterSettings)); addAllocationDecider(deciders, new SnapshotInProgressAllocationDecider(settings));
addAllocationDecider(deciders, new FilterAllocationDecider(settings, clusterSettings)); addAllocationDecider(deciders, new FilterAllocationDecider(settings, clusterSettings));
addAllocationDecider(deciders, new SameShardAllocationDecider(settings)); addAllocationDecider(deciders, new SameShardAllocationDecider(settings));
addAllocationDecider(deciders, new DiskThresholdDecider(settings, clusterSettings)); addAllocationDecider(deciders, new DiskThresholdDecider(settings, clusterSettings));

View File

@ -23,9 +23,6 @@ import org.elasticsearch.cluster.SnapshotsInProgress;
import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNode;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
/** /**
@ -36,22 +33,6 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
public static final String NAME = "snapshot_in_progress"; public static final String NAME = "snapshot_in_progress";
/**
* Disables relocation of shards that are currently being snapshotted.
*/
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING =
Setting.boolSetting("cluster.routing.allocation.snapshot.relocation_enabled", false,
Property.Dynamic, Property.NodeScope);
private volatile boolean enableRelocation = false;
/**
* Creates a new {@link org.elasticsearch.cluster.routing.allocation.decider.SnapshotInProgressAllocationDecider} instance
*/
public SnapshotInProgressAllocationDecider() {
this(Settings.Builder.EMPTY_SETTINGS);
}
/** /**
* Creates a new {@link org.elasticsearch.cluster.routing.allocation.decider.SnapshotInProgressAllocationDecider} instance from * Creates a new {@link org.elasticsearch.cluster.routing.allocation.decider.SnapshotInProgressAllocationDecider} instance from
* given settings * given settings
@ -59,18 +40,7 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
* @param settings {@link org.elasticsearch.common.settings.Settings} to use * @param settings {@link org.elasticsearch.common.settings.Settings} to use
*/ */
public SnapshotInProgressAllocationDecider(Settings settings) { public SnapshotInProgressAllocationDecider(Settings settings) {
this(settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
}
public SnapshotInProgressAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
super(settings); super(settings);
enableRelocation = CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING.get(settings);
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING,
this::setEnableRelocation);
}
private void setEnableRelocation(boolean enableRelocation) {
this.enableRelocation = enableRelocation;
} }
/** /**
@ -93,7 +63,7 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
} }
private Decision canMove(ShardRouting shardRouting, RoutingAllocation allocation) { private Decision canMove(ShardRouting shardRouting, RoutingAllocation allocation) {
if (!enableRelocation && shardRouting.primary()) { if (shardRouting.primary()) {
// Only primary shards are snapshotted // Only primary shards are snapshotted
SnapshotsInProgress snapshotsInProgress = allocation.custom(SnapshotsInProgress.TYPE); SnapshotsInProgress snapshotsInProgress = allocation.custom(SnapshotsInProgress.TYPE);

View File

@ -209,7 +209,6 @@ public final class ClusterSettings extends AbstractScopedSettings {
SameShardAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING, SameShardAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING,
InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING, InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING,
InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING, InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING,
SnapshotInProgressAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING,
DestructiveOperations.REQUIRES_NAME_SETTING, DestructiveOperations.REQUIRES_NAME_SETTING,
DiscoverySettings.PUBLISH_TIMEOUT_SETTING, DiscoverySettings.PUBLISH_TIMEOUT_SETTING,
DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING, DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING,