Skip to content

Introduce IndexSettingDeprecatedInV8AndRemovedInV9 Setting property #120334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/120334.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 120334
summary: Introduce `IndexSettingDeprecatedInV8AndRemovedInV9` Setting property
area: Infra/Settings
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -151,10 +152,16 @@ 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 IndexSettingDeprecatedInV8AndRemovedInV10
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // remove constant if indices created in V7 couldn't be read by v10 anymore
// note we still need v7 settings in v9 because we support reading from N-2 indices now
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.
Expand All @@ -176,7 +183,8 @@ public enum Property {
private static final EnumSet<Property> DEPRECATED_PROPERTIES = EnumSet.of(
Property.Deprecated,
Property.DeprecatedWarning,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
Property.IndexSettingDeprecatedInV7AndRemovedInV8,
Property.IndexSettingDeprecatedInV8AndRemovedInV9
);

@SuppressWarnings("this-escape")
Expand Down Expand Up @@ -216,6 +224,7 @@ private Setting(
checkPropertyRequiresIndexScope(propertiesAsSet, Property.InternalIndex);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.PrivateIndex);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV7AndRemovedInV8);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV8AndRemovedInV9);
checkPropertyRequiresNodeScope(propertiesAsSet);
this.properties = propertiesAsSet;
}
Expand Down Expand Up @@ -450,7 +459,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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down