|
@@ -23,9 +23,6 @@ import org.elasticsearch.cluster.SnapshotsInProgress;
|
|
|
import org.elasticsearch.cluster.routing.RoutingNode;
|
|
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
@@ -36,22 +33,6 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
|
|
|
|
|
|
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
|
|
|
* given settings
|
|
@@ -59,18 +40,7 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
|
|
|
* @param settings {@link org.elasticsearch.common.settings.Settings} to use
|
|
|
*/
|
|
|
public SnapshotInProgressAllocationDecider(Settings settings) {
|
|
|
- this(settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
|
|
|
- }
|
|
|
-
|
|
|
- public SnapshotInProgressAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
|
|
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) {
|
|
|
- if (!enableRelocation && shardRouting.primary()) {
|
|
|
+ if (shardRouting.primary()) {
|
|
|
// Only primary shards are snapshotted
|
|
|
|
|
|
SnapshotsInProgress snapshotsInProgress = allocation.custom(SnapshotsInProgress.TYPE);
|