-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Re-define index.mapper.dynamic setting in 8.x #109341
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
elasticsearchmachine
merged 15 commits into
elastic:main
from
martijnvg:index-mapper-index-setting-test-main
Jun 11, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a1999c1
Add rolling upgrade test for the index.mapper.dynamic index setting bug.
martijnvg 5317666
Merge remote-tracking branch 'es/main' into index-mapper-index-settin…
martijnvg 6d20552
spotless
martijnvg 7b9be44
add full cluster restart test
martijnvg 344fad0
added expected warning to open request
martijnvg 3b1cb34
Merge remote-tracking branch 'es/main' into index-mapper-index-settin…
martijnvg 4d41a4f
Merge remote-tracking branch 'es/main' into index-mapper-index-settin…
martijnvg 91bb6d6
Merge remote-tracking branch 'es/main' into index-mapper-index-settin…
martijnvg 5ca4252
fix expected warning
martijnvg 015caef
re-define index.mapper.dynamic setting
martijnvg 1bebb39
Update docs/changelog/109341.yaml
martijnvg e220ffa
spotless
martijnvg 55cb3a9
iter summary
martijnvg 90e175e
added update for 9 annotation
martijnvg 9292e9e
Merge remote-tracking branch 'es/main' into index-mapper-index-settin…
martijnvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 109341 | ||
| summary: Re-define `index.mapper.dynamic` setting in 8.x for a better 7.x to 8.x upgrade if this setting is used. | ||
| area: Mapping | ||
| type: bug | ||
| issues: [] |
82 changes: 82 additions & 0 deletions
82
...start/src/javaRestTest/java/org/elasticsearch/upgrades/UpgradeWithOldIndexSettingsIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| package org.elasticsearch.upgrades; | ||
|
|
||
| import com.carrotsearch.randomizedtesting.annotations.Name; | ||
|
|
||
| import org.elasticsearch.client.Request; | ||
| import org.elasticsearch.client.ResponseException; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.xcontent.support.XContentMapValues; | ||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.test.cluster.FeatureFlag; | ||
| import org.elasticsearch.test.cluster.local.LocalClusterConfigProvider; | ||
| import org.elasticsearch.test.cluster.local.distribution.DistributionType; | ||
| import org.junit.ClassRule; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| import static org.hamcrest.Matchers.containsString; | ||
| import static org.hamcrest.Matchers.equalTo; | ||
|
|
||
| public class UpgradeWithOldIndexSettingsIT extends ParameterizedFullClusterRestartTestCase { | ||
|
|
||
| protected static LocalClusterConfigProvider clusterConfig = c -> {}; | ||
|
|
||
| @ClassRule | ||
| public static ElasticsearchCluster cluster = ElasticsearchCluster.local() | ||
| .distribution(DistributionType.DEFAULT) | ||
| .version(getOldClusterTestVersion()) | ||
| .nodes(2) | ||
| .setting("xpack.security.enabled", "false") | ||
| .feature(FeatureFlag.FAILURE_STORE_ENABLED) | ||
| .apply(() -> clusterConfig) | ||
| .build(); | ||
|
|
||
| @Override | ||
| protected ElasticsearchCluster getUpgradeCluster() { | ||
| return cluster; | ||
| } | ||
|
|
||
| public UpgradeWithOldIndexSettingsIT(@Name("cluster") FullClusterRestartUpgradeStatus upgradeStatus) { | ||
| super(upgradeStatus); | ||
| } | ||
|
|
||
| public void testMapperDynamicIndexSetting() throws IOException { | ||
| assumeTrue( | ||
| "Setting deprecated in 6.x, but remained in 7.x and is no longer defined in 8.x", | ||
| getOldClusterTestVersion().before("8.0.0") | ||
| ); | ||
| String indexName = "my-index"; | ||
| if (isRunningAgainstOldCluster()) { | ||
| createIndex(indexName); | ||
|
|
||
| var request = new Request("PUT", "/my-index/_settings"); | ||
| request.setJsonEntity(org.elasticsearch.common.Strings.toString(Settings.builder().put("index.mapper.dynamic", true).build())); | ||
| request.setOptions( | ||
| expectWarnings( | ||
| "[index.mapper.dynamic] setting was deprecated in Elasticsearch and will be removed in a future release! " | ||
| + "See the breaking changes documentation for the next major version." | ||
| ) | ||
| ); | ||
| assertOK(client().performRequest(request)); | ||
| } else { | ||
| var indexSettings = getIndexSettings(indexName); | ||
| assertThat(XContentMapValues.extractValue(indexName + ".settings.index.mapper.dynamic", indexSettings), equalTo("true")); | ||
| ensureGreen(indexName); | ||
| // New indices can never define the index.mapper.dynamic setting. | ||
| Exception e = expectThrows( | ||
| ResponseException.class, | ||
| () -> createIndex("my-index2", Settings.builder().put("index.mapper.dynamic", true).build()) | ||
| ); | ||
| assertThat(e.getMessage(), containsString("unknown setting [index.mapper.dynamic]")); | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use @UpdateForV9 instead of TODO?