From db9c756c2cc4db7424fa145e764593aebd4186eb Mon Sep 17 00:00:00 2001 From: alexey-ivanov-es Date: Thu, 16 Jan 2025 22:51:03 +0000 Subject: [PATCH 1/3] Introduce IndexSettingDeprecatedInV8AndRemovedInV9 Settings property --- .../java/org/elasticsearch/common/settings/Setting.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/common/settings/Setting.java b/server/src/main/java/org/elasticsearch/common/settings/Setting.java index 16c6844f46402..18d6451dfec50 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/Setting.java +++ b/server/src/main/java/org/elasticsearch/common/settings/Setting.java @@ -24,6 +24,7 @@ import org.elasticsearch.core.Nullable; import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.Tuple; +import org.elasticsearch.core.UpdateForV10; import org.elasticsearch.core.UpdateForV9; import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.xcontent.ToXContentObject; @@ -151,9 +152,15 @@ public enum Property { * Indicates that this index-level setting was deprecated in {@link Version#V_7_17_0} and is * forbidden in indices created from {@link Version#V_8_0_0} onwards. */ - @UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // introduce IndexSettingDeprecatedInV8AndRemovedInV9 to replace this constant + @UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // remove constant if indices created in V7 couldn't be read by v10 anymore IndexSettingDeprecatedInV7AndRemovedInV8, + /** + * Indicates that this index-level setting was deprecated in {@link Version#V_8_18_0} and is + * forbidden in indices created from {@link Version#V_9_0_0} onwards. + */ + IndexSettingDeprecatedInV8AndRemovedInV9, + /** * Indicates that this setting is accessible by non-operator users (public) in serverless * Users will be allowed to set and see values of this setting. From 2196ac19ab8d6dffefa1a049eb57a5908abf3ba2 Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Thu, 16 Jan 2025 23:11:35 +0000 Subject: [PATCH 2/3] Update docs/changelog/120334.yaml --- docs/changelog/120334.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/120334.yaml diff --git a/docs/changelog/120334.yaml b/docs/changelog/120334.yaml new file mode 100644 index 0000000000000..d3ac34845f9d8 --- /dev/null +++ b/docs/changelog/120334.yaml @@ -0,0 +1,5 @@ +pr: 120334 +summary: Introduce `IndexSettingDeprecatedInV8AndRemovedInV9` Setting property +area: Infra/Settings +type: enhancement +issues: [] From 0a0d1a4955d8fc0fcc514e62880eaffaa2ffa036 Mon Sep 17 00:00:00 2001 From: alexey-ivanov-es Date: Thu, 16 Jan 2025 23:24:13 +0000 Subject: [PATCH 3/3] Deprecation warning --- .../java/org/elasticsearch/common/settings/Setting.java | 7 +++++-- .../org/elasticsearch/common/settings/SettingTests.java | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/settings/Setting.java b/server/src/main/java/org/elasticsearch/common/settings/Setting.java index 18d6451dfec50..7a352c350d750 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/Setting.java +++ b/server/src/main/java/org/elasticsearch/common/settings/Setting.java @@ -182,7 +182,8 @@ public enum Property { private static final EnumSet DEPRECATED_PROPERTIES = EnumSet.of( Property.Deprecated, Property.DeprecatedWarning, - Property.IndexSettingDeprecatedInV7AndRemovedInV8 + Property.IndexSettingDeprecatedInV7AndRemovedInV8, + Property.IndexSettingDeprecatedInV8AndRemovedInV9 ); @SuppressWarnings("this-escape") @@ -222,6 +223,7 @@ private Setting( checkPropertyRequiresIndexScope(propertiesAsSet, Property.InternalIndex); checkPropertyRequiresIndexScope(propertiesAsSet, Property.PrivateIndex); checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV7AndRemovedInV8); + checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV8AndRemovedInV9); checkPropertyRequiresNodeScope(propertiesAsSet); this.properties = propertiesAsSet; } @@ -456,7 +458,8 @@ public boolean hasIndexScope() { private boolean isDeprecated() { return properties.contains(Property.Deprecated) || properties.contains(Property.DeprecatedWarning) - || properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8); + || properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8) + || properties.contains(Property.IndexSettingDeprecatedInV8AndRemovedInV9); } private boolean isDeprecatedWarningOnly() { diff --git a/server/src/test/java/org/elasticsearch/common/settings/SettingTests.java b/server/src/test/java/org/elasticsearch/common/settings/SettingTests.java index 0fbe36ec9c2d2..3b0516df57964 100644 --- a/server/src/test/java/org/elasticsearch/common/settings/SettingTests.java +++ b/server/src/test/java/org/elasticsearch/common/settings/SettingTests.java @@ -1521,6 +1521,14 @@ public void testDeprecationPropertyValidation() { IllegalArgumentException.class, () -> Setting.boolSetting("a.bool.setting", true, Property.DeprecatedWarning, Property.IndexSettingDeprecatedInV7AndRemovedInV8) ); + expectThrows( + IllegalArgumentException.class, + () -> Setting.boolSetting("a.bool.setting", true, Property.Deprecated, Property.IndexSettingDeprecatedInV8AndRemovedInV9) + ); + expectThrows( + IllegalArgumentException.class, + () -> Setting.boolSetting("a.bool.setting", true, Property.DeprecatedWarning, Property.IndexSettingDeprecatedInV8AndRemovedInV9) + ); } public void testIntSettingBounds() {