Skip to content

Commit d53c99c

Browse files
Introduce IndexSettingDeprecatedInV8AndRemovedInV9 Setting property (#120334)
1 parent e7a9690 commit d53c99c

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

docs/changelog/120334.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120334
2+
summary: Introduce `IndexSettingDeprecatedInV8AndRemovedInV9` Setting property
3+
area: Infra/Settings
4+
type: enhancement
5+
issues: []

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.core.Nullable;
2525
import org.elasticsearch.core.TimeValue;
2626
import org.elasticsearch.core.Tuple;
27+
import org.elasticsearch.core.UpdateForV10;
2728
import org.elasticsearch.core.UpdateForV9;
2829
import org.elasticsearch.index.mapper.DateFieldMapper;
2930
import org.elasticsearch.xcontent.ToXContentObject;
@@ -151,10 +152,16 @@ public enum Property {
151152
* Indicates that this index-level setting was deprecated in {@link Version#V_7_17_0} and is
152153
* forbidden in indices created from {@link Version#V_8_0_0} onwards.
153154
*/
154-
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // introduce IndexSettingDeprecatedInV8AndRemovedInV10
155+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // remove constant if indices created in V7 couldn't be read by v10 anymore
155156
// note we still need v7 settings in v9 because we support reading from N-2 indices now
156157
IndexSettingDeprecatedInV7AndRemovedInV8,
157158

159+
/**
160+
* Indicates that this index-level setting was deprecated in {@link Version#V_8_18_0} and is
161+
* forbidden in indices created from {@link Version#V_9_0_0} onwards.
162+
*/
163+
IndexSettingDeprecatedInV8AndRemovedInV9,
164+
158165
/**
159166
* Indicates that this setting is accessible by non-operator users (public) in serverless
160167
* Users will be allowed to set and see values of this setting.
@@ -176,7 +183,8 @@ public enum Property {
176183
private static final EnumSet<Property> DEPRECATED_PROPERTIES = EnumSet.of(
177184
Property.Deprecated,
178185
Property.DeprecatedWarning,
179-
Property.IndexSettingDeprecatedInV7AndRemovedInV8
186+
Property.IndexSettingDeprecatedInV7AndRemovedInV8,
187+
Property.IndexSettingDeprecatedInV8AndRemovedInV9
180188
);
181189

182190
@SuppressWarnings("this-escape")
@@ -216,6 +224,7 @@ private Setting(
216224
checkPropertyRequiresIndexScope(propertiesAsSet, Property.InternalIndex);
217225
checkPropertyRequiresIndexScope(propertiesAsSet, Property.PrivateIndex);
218226
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV7AndRemovedInV8);
227+
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV8AndRemovedInV9);
219228
checkPropertyRequiresNodeScope(propertiesAsSet);
220229
this.properties = propertiesAsSet;
221230
}
@@ -450,7 +459,8 @@ public boolean hasIndexScope() {
450459
private boolean isDeprecated() {
451460
return properties.contains(Property.Deprecated)
452461
|| properties.contains(Property.DeprecatedWarning)
453-
|| properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8);
462+
|| properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8)
463+
|| properties.contains(Property.IndexSettingDeprecatedInV8AndRemovedInV9);
454464
}
455465

456466
private boolean isDeprecatedWarningOnly() {

server/src/test/java/org/elasticsearch/common/settings/SettingTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,14 @@ public void testDeprecationPropertyValidation() {
15211521
IllegalArgumentException.class,
15221522
() -> Setting.boolSetting("a.bool.setting", true, Property.DeprecatedWarning, Property.IndexSettingDeprecatedInV7AndRemovedInV8)
15231523
);
1524+
expectThrows(
1525+
IllegalArgumentException.class,
1526+
() -> Setting.boolSetting("a.bool.setting", true, Property.Deprecated, Property.IndexSettingDeprecatedInV8AndRemovedInV9)
1527+
);
1528+
expectThrows(
1529+
IllegalArgumentException.class,
1530+
() -> Setting.boolSetting("a.bool.setting", true, Property.DeprecatedWarning, Property.IndexSettingDeprecatedInV8AndRemovedInV9)
1531+
);
15241532
}
15251533

15261534
public void testIntSettingBounds() {

0 commit comments

Comments
 (0)