Skip to content

Commit

Permalink
Merge branch 'main' into scriptmodule
Browse files Browse the repository at this point in the history
  • Loading branch information
jdconrad committed Jan 22, 2025
2 parents 7d7db91 + b985b3e commit c7a7367
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 136 deletions.
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: []
15 changes: 3 additions & 12 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,12 @@ tests:
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
method: testEnrichExplosionManyMatches
issue: https://github.com/elastic/elasticsearch/issues/120587
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {lookup-join.NonUniqueRightKeyOnTheCoordinator ASYNC}
issue: https://github.com/elastic/elasticsearch/issues/120600
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {lookup-join.NonUniqueRightKeyFromRow ASYNC}
issue: https://github.com/elastic/elasticsearch/issues/120601
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {lookup-join.NonUniqueRightKeyFromRow SYNC}
issue: https://github.com/elastic/elasticsearch/issues/120602
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {lookup-join.NonUniqueRightKeyOnTheCoordinator SYNC}
issue: https://github.com/elastic/elasticsearch/issues/120603
- class: org.elasticsearch.index.reindex.BulkByScrollUsesAllScrollDocumentsAfterConflictsIntegTests
method: testReindex
issue: https://github.com/elastic/elasticsearch/issues/120605
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=migrate/30_create_from/Test create_from with remove_index_blocks set to false}
issue: https://github.com/elastic/elasticsearch/issues/120657

# Examples:
#
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ private void generateMapping(
}

if (templateEntry instanceof Template.Leaf leaf) {
// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
if (leaf.type() == FieldType.KEYWORD) {
context.addCopyToCandidate(fieldName);
}

var mappingParametersGenerator = specification.dataSource()
.get(
new DataSourceRequest.LeafMappingParametersGenerator(
Expand All @@ -120,6 +115,11 @@ private void generateMapping(
mappingParameters.put("type", leaf.type().toString());
mappingParameters.putAll(mappingParametersGenerator.get());

// For simplicity we only copy to keyword fields, synthetic source logic to handle copy_to is generic.
if (leaf.type() == FieldType.KEYWORD) {
context.addCopyToCandidate(fieldName);
}

} else if (templateEntry instanceof Template.Object object) {
var mappingParametersGenerator = specification.dataSource()
.get(new DataSourceRequest.ObjectMappingParametersGenerator(false, object.nested(), context.parentSubobjects()))
Expand Down
Loading

0 comments on commit c7a7367

Please sign in to comment.