Add prefer_v2_templates flag and index setting#55411
Merged
dakrone merged 8 commits intoelastic:masterfrom Apr 20, 2020
Merged
Conversation
This commit adds a new querystring parameter on the following APIs: - Index - Update - Bulk - Create Index - Rollover These APIs now support a `?prefer_v2_templates=true|false` flag. This flag changes the preference creation to use either V2 index templates or V1 templates. This flag defaults to `false` and will be changed to `true` for 8.0+ in subsequent work. Additionally, setting this flag internally sets the `index.prefer_v2_templates` index-level setting. This setting is used so that actions that automatically create a new index (things like rollover initiated by ILM) will inherit the preference from the original index. This setting is dynamic so that a transition from v1 to v2 templates can occur for longrunning indices grouped by an alias performing periodic rollover. This also adds support for sending this parameter to the High Level Rest Client. Relates to elastic#53101
Collaborator
|
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
Member
Author
|
This work does not yet change the default to |
Member
Author
|
@elasticmachine update branch |
(will be adjusted back down later)
andreidan
approved these changes
Apr 20, 2020
server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java
Show resolved
Hide resolved
client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexRequest.java
Show resolved
Hide resolved
...java/org/elasticsearch/action/admin/indices/create/CreateIndexClusterStateUpdateRequest.java
Outdated
Show resolved
Hide resolved
...java/org/elasticsearch/action/admin/indices/create/CreateIndexClusterStateUpdateRequest.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/index/IndexRequest.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| private static boolean resolvePreferV2Templates(CreateIndexClusterStateUpdateRequest request) { |
Contributor
There was a problem hiding this comment.
this is pretty cool, aides readability quite a lot
Member
Author
|
@elasticmachine update branch |
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 20, 2020
This commit adds a new querystring parameter on the following APIs: - Index - Update - Bulk - Create Index - Rollover These APIs now support a `?prefer_v2_templates=true|false` flag. This flag changes the preference creation to use either V2 index templates or V1 templates. This flag defaults to `false` and will be changed to `true` for 8.0+ in subsequent work. Additionally, setting this flag internally sets the `index.prefer_v2_templates` index-level setting. This setting is used so that actions that automatically create a new index (things like rollover initiated by ILM) will inherit the preference from the original index. This setting is dynamic so that a transition from v1 to v2 templates can occur for long-running indices grouped by an alias performing periodic rollover. This also adds support for sending this parameter to the High Level Rest Client. Relates to elastic#53101
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 20, 2020
This adjusts the minimum version for serialization for elastic#55411. It should only be merged after elastic#55476 has been merged
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 20, 2020
This disableds BWC for the backport of elastic#55411 Backport: elastic#55476 Version adjustment: elastic#55478
dakrone
added a commit
that referenced
this pull request
Apr 20, 2020
dakrone
added a commit
that referenced
this pull request
Apr 20, 2020
This commit adds a new querystring parameter on the following APIs: - Index - Update - Bulk - Create Index - Rollover These APIs now support a `?prefer_v2_templates=true|false` flag. This flag changes the preference creation to use either V2 index templates or V1 templates. This flag defaults to `false` and will be changed to `true` for 8.0+ in subsequent work. Additionally, setting this flag internally sets the `index.prefer_v2_templates` index-level setting. This setting is used so that actions that automatically create a new index (things like rollover initiated by ILM) will inherit the preference from the original index. This setting is dynamic so that a transition from v1 to v2 templates can occur for long-running indices grouped by an alias performing periodic rollover. This also adds support for sending this parameter to the High Level Rest Client. Relates to #53101
dakrone
added a commit
that referenced
this pull request
Apr 20, 2020
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 20, 2020
As a followup to elastic#55411, this commit changes the default for the `?prefer_v2_templates` querystring parameter to be `true`. This means that V2 templates will take precedence by default in 8.0+ Relates to elastic#53101
dakrone
added a commit
that referenced
this pull request
Apr 21, 2020
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 21, 2020
If some of the nodes are pre-7.8 nodes, they may not support the `index.prefer_v2_templates` setting (since it exists only on 7.8+). This commit makes sure that we only add this setting to the index's metadata if all of the nodes are 7.8+. Otherwise we get errors like: ``` [ WARN ][o.e.i.c.IndicesClusterStateService] [v7.7.0-3] [test-snapshot-index][2] marking and sending shard failed due to [failed to create index] java.lang.IllegalArgumentException: unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:544) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:489) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:460) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:595) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:549) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:176) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.cluster.IndicesClusterStateService.createIndices(IndicesClusterStateService.java:484) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyClusterState(IndicesClusterStateService.java:246) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.cluster.service.ClusterApplierService.lambda$callClusterStateAppliers$5(ClusterApplierService.java:517) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] ``` Relates to elastic#55411 Relates to elastic#53101 Resolves elastic#55539
dakrone
added a commit
that referenced
this pull request
Apr 21, 2020
…#55546) If some of the nodes are pre-7.8 nodes, they may not support the `index.prefer_v2_templates` setting (since it exists only on 7.8+). This commit makes sure that we only add this setting to the index's metadata if all of the nodes are 7.8+. Otherwise we get errors like: ``` [ WARN ][o.e.i.c.IndicesClusterStateService] [v7.7.0-3] [test-snapshot-index][2] marking and sending shard failed due to [failed to create index] java.lang.IllegalArgumentException: unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:544) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:489) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:460) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:595) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:549) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:176) ~[elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.cluster.IndicesClusterStateService.createIndices(IndicesClusterStateService.java:484) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyClusterState(IndicesClusterStateService.java:246) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] at org.elasticsearch.cluster.service.ClusterApplierService.lambda$callClusterStateAppliers$5(ClusterApplierService.java:517) [elasticsearch-7.7.0-SNAPSHOT.jar:7.7.0-SNAPSHOT] ``` Relates to #55411 Relates to #53101 Resolves #55539
17 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit adds a new querystring parameter on the following APIs:
These APIs now support a
?prefer_v2_templates=true|falseflag. This flag changes the preferencecreation to use either V2 index templates or V1 templates. This flag defaults to
falseand will bechanged to
truefor 8.0+ in subsequent work.Additionally, setting this flag internally sets the
index.prefer_v2_templatesindex-level setting.This setting is used so that actions that automatically create a new index (things like rollover
initiated by ILM) will inherit the preference from the original index. This setting is dynamic so
that a transition from v1 to v2 templates can occur for long-running indices grouped by an alias
performing periodic rollover.
This also adds support for sending this parameter to the High Level Rest Client.
Relates to #53101