From e09d406049b15249990eb9e03d316550df889357 Mon Sep 17 00:00:00 2001 From: Artem Prigoda Date: Wed, 6 Nov 2024 18:56:40 +0100 Subject: [PATCH] Remove `cluster.routing.allocation.disk.watermark.enable_for_single_data_node` setting (#114207) 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 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 https://github.com/elastic/elasticsearch/pull/73733 (7.14), and was made to accept only `true` in https://github.com/elastic/elasticsearch/pull/73737 (8.0). --- docs/changelog/114207.yaml | 15 ++++++++++ .../decider/DiskThresholdDecider.java | 24 ---------------- .../common/settings/ClusterSettings.java | 2 -- .../decider/DiskThresholdDeciderTests.java | 28 ------------------- .../AutoscalingStorageIntegTestCase.java | 4 +-- .../xpack/deprecation/DeprecationChecks.java | 1 - .../deprecation/NodeDeprecationChecks.java | 23 --------------- .../NodeDeprecationChecksTests.java | 28 ------------------- 8 files changed, 16 insertions(+), 109 deletions(-) create mode 100644 docs/changelog/114207.yaml diff --git a/docs/changelog/114207.yaml b/docs/changelog/114207.yaml new file mode 100644 index 0000000000000..2a0a8ae87452a --- /dev/null +++ b/docs/changelog/114207.yaml @@ -0,0 +1,15 @@ +pr: 114207 +summary: Remove `cluster.routing.allocation.disk.watermark.enable_for_single_data_node` setting +area: Allocation +type: breaking +issues: [] +breaking: + title: Remove `cluster.routing.allocation.disk.watermark.enable_for_single_data_node` setting + area: 'Cluster and node setting' + details: >- + Prior to 7.8, whenever a cluster had only a single data node, the watermarks would not be respected. + In order to change this in 7.8+ in a backwards compatible way, we introduced the + `cluster.routing.allocation.disk.watermark.enable_for_single_data_node` + node setting. The setting was deprecated in 7.14 and was made to accept only true in 8.0 + impact: No known end user impact + notable: false diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java index ea6f93cbc881b..35ab786c96e21 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java @@ -25,9 +25,7 @@ import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.core.UpdateForV9; import org.elasticsearch.snapshots.SnapshotShardSizeInfo; import java.util.Map; @@ -72,25 +70,6 @@ public class DiskThresholdDecider extends AllocationDecider { public static final String NAME = "disk_threshold"; - @UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) - public static final Setting ENABLE_FOR_SINGLE_DATA_NODE = Setting.boolSetting( - "cluster.routing.allocation.disk.watermark.enable_for_single_data_node", - true, - new Setting.Validator<>() { - @Override - public void validate(Boolean value) { - if (value == Boolean.FALSE) { - throw new SettingsException( - "setting [{}=false] is not allowed, only true is valid", - ENABLE_FOR_SINGLE_DATA_NODE.getKey() - ); - } - } - }, - Setting.Property.NodeScope, - Setting.Property.DeprecatedWarning - ); - public static final Setting SETTING_IGNORE_DISK_WATERMARKS = Setting.boolSetting( "index.routing.allocation.disk.watermark.ignore", false, @@ -102,9 +81,6 @@ public void validate(Boolean value) { public DiskThresholdDecider(Settings settings, ClusterSettings clusterSettings) { this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings); - // get deprecation warnings. - boolean enabledForSingleDataNode = ENABLE_FOR_SINGLE_DATA_NODE.get(settings); - assert enabledForSingleDataNode; } /** diff --git a/server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java b/server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java index 456602d952e9f..a9a9411de8e1f 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java +++ b/server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java @@ -51,7 +51,6 @@ import org.elasticsearch.cluster.routing.allocation.decider.AwarenessAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ConcurrentRebalanceAllocationDecider; -import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider; @@ -272,7 +271,6 @@ public void apply(Settings value, Settings current, Settings previous) { ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING, - DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE, DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING, DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_MAX_HEADROOM_SETTING, DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING, diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index 1392058f45384..e2d08a6884b68 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -45,8 +45,6 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.common.UUIDs; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.index.Index; @@ -1070,9 +1068,6 @@ private void doTestWatermarksEnabledForSingleDataNode(boolean testMaxHeadroom) { ByteSizeValue.ofGb(110).toString() ); } - if (randomBoolean()) { - builder = builder.put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), true); - } Settings diskSettings = builder.build(); final long totalBytes = testMaxHeadroom ? ByteSizeValue.ofGb(10000).getBytes() : 100; @@ -1151,10 +1146,6 @@ private void doTestWatermarksEnabledForSingleDataNode(boolean testMaxHeadroom) { + "on node, actual free: [20b], actual used: [80%]" ) ); - - if (DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.exists(diskSettings)) { - assertSettingDeprecationsAndWarnings(new Setting[] { DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE }); - } } public void testWatermarksEnabledForSingleDataNodeWithPercentages() { @@ -1165,25 +1156,6 @@ public void testWatermarksEnabledForSingleDataNodeWithMaxHeadroom() { doTestWatermarksEnabledForSingleDataNode(true); } - public void testSingleDataNodeDeprecationWarning() { - Settings settings = Settings.builder().put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), false).build(); - - IllegalArgumentException e = expectThrows( - IllegalArgumentException.class, - () -> new DiskThresholdDecider(settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)) - ); - - assertThat( - e.getCause().getMessage(), - equalTo( - "setting [cluster.routing.allocation.disk.watermark.enable_for_single_data_node=false] is not allowed," - + " only true is valid" - ) - ); - - assertSettingDeprecationsAndWarnings(new Setting[] { DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE }); - } - private void doTestDiskThresholdWithSnapshotShardSizes(boolean testMaxHeadroom) { final long shardSizeInBytes = randomBoolean() ? (testMaxHeadroom ? ByteSizeValue.ofGb(99).getBytes() : 10L) // fits free space of node1 diff --git a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/AutoscalingStorageIntegTestCase.java b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/AutoscalingStorageIntegTestCase.java index 01b78bb0063c1..83bd9399274d6 100644 --- a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/AutoscalingStorageIntegTestCase.java +++ b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/AutoscalingStorageIntegTestCase.java @@ -12,7 +12,6 @@ import org.elasticsearch.cluster.DiskUsageIntegTestCase; import org.elasticsearch.cluster.InternalClusterInfoService; import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings; -import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.datastreams.DataStreamsPlugin; import org.elasticsearch.plugins.Plugin; @@ -40,8 +39,7 @@ protected Settings nodeSettings(final int nodeOrdinal, final Settings otherSetti builder.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), LOW_WATERMARK_BYTES + "b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), HIGH_WATERMARK_BYTES + "b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "0b") - .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "0ms") - .put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), "true"); + .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "0ms"); return builder.build(); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java index 4329cc65f262f..2f875cc1a3fa9 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java @@ -42,7 +42,6 @@ private DeprecationChecks() {} NodeDeprecationChecks::checkDataPathsList, NodeDeprecationChecks::checkSharedDataPathSetting, NodeDeprecationChecks::checkReservedPrefixedRealmNames, - NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting, NodeDeprecationChecks::checkExporterUseIngestPipelineSettings, NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting, NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting, diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index b265dd5e44710..349762456cd3b 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -10,7 +10,6 @@ import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.allocation.DataTier; -import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; @@ -216,28 +215,6 @@ static DeprecationIssue checkReservedPrefixedRealmNames( } } - static DeprecationIssue checkSingleDataNodeWatermarkSetting( - final Settings settings, - final PluginsAndModules pluginsAndModules, - final ClusterState clusterState, - final XPackLicenseState licenseState - ) { - if (DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.exists(settings)) { - String key = DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(); - return new DeprecationIssue( - DeprecationIssue.Level.CRITICAL, - String.format(Locale.ROOT, "setting [%s] is deprecated and will not be available in a future version", key), - "https://www.elastic.co/guide/en/elasticsearch/reference/7.14/" - + "breaking-changes-7.14.html#deprecate-single-data-node-watermark", - String.format(Locale.ROOT, "found [%s] configured. Discontinue use of this setting.", key), - false, - null - ); - } - - return null; - } - private static DeprecationIssue deprecatedAffixSetting( Setting.AffixSetting deprecatedAffixSetting, String detailPattern, diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 282fa6c8960cd..9d89a3cbe328e 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -13,7 +13,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.routing.allocation.DataTier; -import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.Setting; @@ -211,33 +210,6 @@ public void testCheckReservedPrefixedRealmNames() { ); } - public void testSingleDataNodeWatermarkSetting() { - Settings settings = Settings.builder().put(DiskThresholdDecider.ENABLE_FOR_SINGLE_DATA_NODE.getKey(), true).build(); - - List issues = DeprecationChecks.filterChecks( - NODE_SETTINGS_CHECKS, - c -> c.apply(settings, null, ClusterState.EMPTY_STATE, new XPackLicenseState(() -> 0)) - ); - - final String expectedUrl = "https://www.elastic.co/guide/en/elasticsearch/reference/7.14/" - + "breaking-changes-7.14.html#deprecate-single-data-node-watermark"; - assertThat( - issues, - hasItem( - new DeprecationIssue( - DeprecationIssue.Level.CRITICAL, - "setting [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] is deprecated and" - + " will not be available in a future version", - expectedUrl, - "found [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] configured." - + " Discontinue use of this setting.", - false, - null - ) - ) - ); - } - void monitoringSetting(String settingKey, String value) { Settings settings = Settings.builder().put(settingKey, value).build(); List issues = DeprecationChecks.filterChecks(