Skip to content

Commit ea54648

Browse files
committed
Remove cluster.routing.allocation.disk.watermark.enable_for_single_data_node setting
Prior to 7.8, whenever a cluster had only a single data node, the watermarks would not be respected. This was incompatible with how storage based autoscaling on ESS/ECH works and in order to change this in 7.8+ in a backwards compatible way, we had to introduce the `cluster.routing.allocation.disk.watermark.enable_for_single_data_node node` setting. The setting was deprecated in elastic#73733 (7.14), and was made to accept only `true` in elastic#73737 (8.0).
1 parent 4ef5ea6 commit ea54648

File tree

7 files changed

+1
-107
lines changed

7 files changed

+1
-107
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
import org.elasticsearch.common.settings.ClusterSettings;
2626
import org.elasticsearch.common.settings.Setting;
2727
import org.elasticsearch.common.settings.Settings;
28-
import org.elasticsearch.common.settings.SettingsException;
2928
import org.elasticsearch.common.unit.ByteSizeValue;
30-
import org.elasticsearch.core.UpdateForV9;
3129
import org.elasticsearch.snapshots.SnapshotShardSizeInfo;
3230

3331
import java.util.Map;
@@ -72,25 +70,6 @@ public class DiskThresholdDecider extends AllocationDecider {
7270

7371
public static final String NAME = "disk_threshold";
7472

75-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION)
76-
public static final Setting<Boolean> ENABLE_FOR_SINGLE_DATA_NODE = Setting.boolSetting(
77-
"cluster.routing.allocation.disk.watermark.enable_for_single_data_node",
78-
true,
79-
new Setting.Validator<>() {
80-
@Override
81-
public void validate(Boolean value) {
82-
if (value == Boolean.FALSE) {
83-
throw new SettingsException(
84-
"setting [{}=false] is not allowed, only true is valid",
85-
ENABLE_FOR_SINGLE_DATA_NODE.getKey()
86-
);
87-
}
88-
}
89-
},
90-
Setting.Property.NodeScope,
91-
Setting.Property.DeprecatedWarning
92-
);
93-
9473
public static final Setting<Boolean> SETTING_IGNORE_DISK_WATERMARKS = Setting.boolSetting(
9574
"index.routing.allocation.disk.watermark.ignore",
9675
false,
@@ -102,9 +81,6 @@ public void validate(Boolean value) {
10281

10382
public DiskThresholdDecider(Settings settings, ClusterSettings clusterSettings) {
10483
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
105-
// get deprecation warnings.
106-
boolean enabledForSingleDataNode = ENABLE_FOR_SINGLE_DATA_NODE.get(settings);
107-
assert enabledForSingleDataNode;
10884
}
10985

11086
/**

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import org.elasticsearch.cluster.routing.allocation.decider.AwarenessAllocationDecider;
5252
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
5353
import org.elasticsearch.cluster.routing.allocation.decider.ConcurrentRebalanceAllocationDecider;
54-
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
5554
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
5655
import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider;
5756
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
@@ -269,7 +268,6 @@ public void apply(Settings value, Settings current, Settings previous) {
269268
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING,
270269
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING,
271270
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING,
272-
DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE,
273271
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING,
274272
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_MAX_HEADROOM_SETTING,
275273
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING,

server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands;
4646
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
4747
import org.elasticsearch.common.UUIDs;
48-
import org.elasticsearch.common.settings.ClusterSettings;
49-
import org.elasticsearch.common.settings.Setting;
5048
import org.elasticsearch.common.settings.Settings;
5149
import org.elasticsearch.common.unit.ByteSizeValue;
5250
import org.elasticsearch.index.Index;
@@ -1070,9 +1068,6 @@ private void doTestWatermarksEnabledForSingleDataNode(boolean testMaxHeadroom) {
10701068
ByteSizeValue.ofGb(110).toString()
10711069
);
10721070
}
1073-
if (randomBoolean()) {
1074-
builder = builder.put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), true);
1075-
}
10761071
Settings diskSettings = builder.build();
10771072

10781073
final long totalBytes = testMaxHeadroom ? ByteSizeValue.ofGb(10000).getBytes() : 100;
@@ -1151,10 +1146,6 @@ private void doTestWatermarksEnabledForSingleDataNode(boolean testMaxHeadroom) {
11511146
+ "on node, actual free: [20b], actual used: [80%]"
11521147
)
11531148
);
1154-
1155-
if (DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.exists(diskSettings)) {
1156-
assertSettingDeprecationsAndWarnings(new Setting<?>[] { DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE });
1157-
}
11581149
}
11591150

11601151
public void testWatermarksEnabledForSingleDataNodeWithPercentages() {
@@ -1165,25 +1156,6 @@ public void testWatermarksEnabledForSingleDataNodeWithMaxHeadroom() {
11651156
doTestWatermarksEnabledForSingleDataNode(true);
11661157
}
11671158

1168-
public void testSingleDataNodeDeprecationWarning() {
1169-
Settings settings = Settings.builder().put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), false).build();
1170-
1171-
IllegalArgumentException e = expectThrows(
1172-
IllegalArgumentException.class,
1173-
() -> new DiskThresholdDecider(settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS))
1174-
);
1175-
1176-
assertThat(
1177-
e.getCause().getMessage(),
1178-
equalTo(
1179-
"setting [cluster.routing.allocation.disk.watermark.enable_for_single_data_node=false] is not allowed,"
1180-
+ " only true is valid"
1181-
)
1182-
);
1183-
1184-
assertSettingDeprecationsAndWarnings(new Setting<?>[] { DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE });
1185-
}
1186-
11871159
private void doTestDiskThresholdWithSnapshotShardSizes(boolean testMaxHeadroom) {
11881160
final long shardSizeInBytes = randomBoolean()
11891161
? (testMaxHeadroom ? ByteSizeValue.ofGb(99).getBytes() : 10L) // fits free space of node1

x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/AutoscalingStorageIntegTestCase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ protected Settings nodeSettings(final int nodeOrdinal, final Settings otherSetti
4040
builder.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), LOW_WATERMARK_BYTES + "b")
4141
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), HIGH_WATERMARK_BYTES + "b")
4242
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "0b")
43-
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "0ms")
44-
.put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), "true");
43+
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "0ms");
4544
return builder.build();
4645
}
4746

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ private DeprecationChecks() {}
4242
NodeDeprecationChecks::checkDataPathsList,
4343
NodeDeprecationChecks::checkSharedDataPathSetting,
4444
NodeDeprecationChecks::checkReservedPrefixedRealmNames,
45-
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
4645
NodeDeprecationChecks::checkExporterUseIngestPipelineSettings,
4746
NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting,
4847
NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting,

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules;
1111
import org.elasticsearch.cluster.ClusterState;
1212
import org.elasticsearch.cluster.routing.allocation.DataTier;
13-
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
1413
import org.elasticsearch.common.settings.SecureSetting;
1514
import org.elasticsearch.common.settings.Setting;
1615
import org.elasticsearch.common.settings.Settings;
@@ -216,28 +215,6 @@ static DeprecationIssue checkReservedPrefixedRealmNames(
216215
}
217216
}
218217

219-
static DeprecationIssue checkSingleDataNodeWatermarkSetting(
220-
final Settings settings,
221-
final PluginsAndModules pluginsAndModules,
222-
final ClusterState clusterState,
223-
final XPackLicenseState licenseState
224-
) {
225-
if (DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.exists(settings)) {
226-
String key = DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey();
227-
return new DeprecationIssue(
228-
DeprecationIssue.Level.CRITICAL,
229-
String.format(Locale.ROOT, "setting [%s] is deprecated and will not be available in a future version", key),
230-
"https://www.elastic.co/guide/en/elasticsearch/reference/7.14/"
231-
+ "breaking-changes-7.14.html#deprecate-single-data-node-watermark",
232-
String.format(Locale.ROOT, "found [%s] configured. Discontinue use of this setting.", key),
233-
false,
234-
null
235-
);
236-
}
237-
238-
return null;
239-
}
240-
241218
private static DeprecationIssue deprecatedAffixSetting(
242219
Setting.AffixSetting<?> deprecatedAffixSetting,
243220
String detailPattern,

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -211,33 +211,6 @@ public void testCheckReservedPrefixedRealmNames() {
211211
);
212212
}
213213

214-
public void testSingleDataNodeWatermarkSetting() {
215-
Settings settings = Settings.builder().put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), true).build();
216-
217-
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(
218-
NODE_SETTINGS_CHECKS,
219-
c -> c.apply(settings, null, ClusterState.EMPTY_STATE, new XPackLicenseState(() -> 0))
220-
);
221-
222-
final String expectedUrl = "https://www.elastic.co/guide/en/elasticsearch/reference/7.14/"
223-
+ "breaking-changes-7.14.html#deprecate-single-data-node-watermark";
224-
assertThat(
225-
issues,
226-
hasItem(
227-
new DeprecationIssue(
228-
DeprecationIssue.Level.CRITICAL,
229-
"setting [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] is deprecated and"
230-
+ " will not be available in a future version",
231-
expectedUrl,
232-
"found [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] configured."
233-
+ " Discontinue use of this setting.",
234-
false,
235-
null
236-
)
237-
)
238-
);
239-
}
240-
241214
void monitoringSetting(String settingKey, String value) {
242215
Settings settings = Settings.builder().put(settingKey, value).build();
243216
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(

0 commit comments

Comments
 (0)