From 25ffd387553223b81d8ce17e78b0dd026f695836 Mon Sep 17 00:00:00 2001 From: gmarouli Date: Thu, 12 Dec 2024 13:47:30 +0200 Subject: [PATCH 1/5] Reject value 'index-setting' for 'wait_for_active_shards' in 9.0 --- .../admin/indices/RestCloseIndexAction.java | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index a2cf3c08196a6..ed95d03508637 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -17,7 +17,8 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationCategory; import org.elasticsearch.common.logging.DeprecationLogger; -import org.elasticsearch.core.UpdateForV9; +import org.elasticsearch.core.RestApiVersion; +import org.elasticsearch.core.UpdateForV10; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.Scope; @@ -47,30 +48,43 @@ public String getName() { } @Override - @UpdateForV9(owner = UpdateForV9.Owner.DATA_MANAGEMENT) public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index"))); closeIndexRequest.masterNodeTimeout(getMasterNodeTimeout(request)); closeIndexRequest.ackTimeout(getAckTimeout(request)); closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions())); + handleIndexSettingWaitForActiveShards(request, closeIndexRequest); + return channel -> client.admin().indices().close(closeIndexRequest, new RestToXContentListener<>(channel)); + } + + /** + * Special handling of the query param 'wait_for_active_shards' because of the deprecated param value 'index-setting'. + * - In 10.x this code should be simplified to simply parsing the active shard count with {@link ActiveShardCount#parseString(String)} + * - In 9.x we throw an error that informs the user about the parameter value removal; unless we are running in rest-compatibility mode + * with 8.x when we log a deprecation warning and handle the value as a noop. + */ + @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT) + private void handleIndexSettingWaitForActiveShards(final RestRequest request, final CloseIndexRequest closeIndexRequest) { String waitForActiveShards = request.param("wait_for_active_shards"); + if (waitForActiveShards == null) { + return; + } if ("index-setting".equalsIgnoreCase(waitForActiveShards)) { - deprecationLogger.warn( - DeprecationCategory.SETTINGS, - "close-index-wait_for_active_shards-index-setting", + String deprecationMessage = "?wait_for_active_shards=index-setting is now the default behaviour; the 'index-setting' value for this parameter " - + "should no longer be used since it will become unsupported in version " - + (Version.V_8_0_0.major + 1) - ); - // TODO in v9: - // - throw an IllegalArgumentException here - // - record the removal of support for this value as a breaking change - // TODO in v10: - // - remove the IllegalArgumentException here - } else if (waitForActiveShards != null) { + + "should no longer be used since it is not supported in version " + + Version.V_9_0_0.major; + if (request.getRestApiVersion() == RestApiVersion.V_8) { + deprecationLogger.warn( + DeprecationCategory.SETTINGS, + "close-index-wait_for_active_shards-index-setting", + deprecationMessage + ); + } else { + throw new IllegalArgumentException(deprecationMessage); + } + } else { closeIndexRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); } - return channel -> client.admin().indices().close(closeIndexRequest, new RestToXContentListener<>(channel)); } - } From 6761baaa3bf6942cb8e2823df4cdcde008e50fd2 Mon Sep 17 00:00:00 2001 From: gmarouli Date: Thu, 12 Dec 2024 13:48:48 +0200 Subject: [PATCH 2/5] Remove unused warning --- .../rest-api-spec/test/data_stream/20_unsupported_apis.yml | 2 -- .../rest-api-spec/test/data_stream/40_supported_apis.yml | 2 -- .../test/data_stream/80_resolve_index_data_streams.yml | 2 -- .../rest-api-spec/test/hdfs_repository/40_restore.yml | 2 -- .../test/secure_hdfs_repository/40_restore.yml | 2 -- .../resources/rest-api-spec/test/cat.aliases/10_basic.yml | 4 ---- .../resources/rest-api-spec/test/cat.indices/10_basic.yml | 6 ------ .../resources/rest-api-spec/test/cat.recovery/10_basic.yml | 2 -- .../resources/rest-api-spec/test/cat.segments/10_basic.yml | 2 -- .../test/cluster.allocation_explain/10_basic.yml | 2 -- .../rest-api-spec/test/cluster.health/10_basic.yml | 4 ---- .../test/cluster.health/30_indices_options.yml | 2 -- .../test/cluster.state/30_expand_wildcards.yml | 2 -- .../resources/rest-api-spec/test/indices.get/10_basic.yml | 2 -- .../rest-api-spec/test/indices.get_alias/10_basic.yml | 2 -- .../test/indices.get_mapping/50_wildcard_expansion.yml | 2 -- .../resources/rest-api-spec/test/indices.open/10_basic.yml | 6 ------ .../rest-api-spec/test/indices.open/20_multiple_indices.yml | 6 ------ .../rest-api-spec/test/indices.put_settings/10_basic.yml | 2 -- .../rest-api-spec/test/indices.recovery/10_basic.yml | 2 -- .../indices.resolve_cluster/10_basic_resolve_cluster.yml | 2 -- .../test/indices.resolve_index/10_basic_resolve_index.yml | 2 -- .../rest-api-spec/test/indices.segments/10_basic.yml | 2 -- .../rest-api-spec/test/search/80_indices_options.yml | 2 -- .../rest-api-spec/test/snapshot.restore/10_basic.yml | 4 ---- .../resources/rest-api-spec/test/tsdb/30_snapshot.yml | 2 -- .../rest-api-spec/test/ccr/follow_and_unfollow.yml | 2 -- .../resources/rest-api-spec/test/ccr/forget_follower.yml | 2 -- .../test/ccr/index_directly_into_follower_index.yml | 2 -- .../rest-api-spec/test/monitoring/bulk/10_basic.yml | 2 -- .../rest-api-spec/test/security/authz/14_cat_indices.yml | 4 ---- .../resources/rest-api-spec/test/snapshot/10_basic.yml | 2 -- .../rest-api-spec/test/fulfilling_cluster/10_basic.yml | 2 -- .../test/fulfilling_cluster/10_basic_with_dls_fls.yml | 2 -- 34 files changed, 88 deletions(-) diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/20_unsupported_apis.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/20_unsupported_apis.yml index 709eb41ccb61d..a1c952d4c0fad 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/20_unsupported_apis.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/20_unsupported_apis.yml @@ -45,8 +45,6 @@ - do: indices.close: index: logs-* - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - length: { indices: 0 } diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/40_supported_apis.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/40_supported_apis.yml index 72fce418d8899..8cbb707034546 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/40_supported_apis.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/40_supported_apis.yml @@ -230,8 +230,6 @@ teardown: - do: indices.close: index: ".ds-simple-data-stream1-*000001,.ds-simple-data-stream1-*000002" - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/80_resolve_index_data_streams.yml b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/80_resolve_index_data_streams.yml index 810b0e43a0da6..eb07438661330 100644 --- a/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/80_resolve_index_data_streams.yml +++ b/modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/80_resolve_index_data_streams.yml @@ -54,8 +54,6 @@ setup: - do: indices.close: index: test_index2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.create: diff --git a/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/hdfs_repository/40_restore.yml b/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/hdfs_repository/40_restore.yml index 716857781b758..a13ad970576fb 100644 --- a/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/hdfs_repository/40_restore.yml +++ b/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/hdfs_repository/40_restore.yml @@ -49,8 +49,6 @@ - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" # Restore index - do: diff --git a/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/secure_hdfs_repository/40_restore.yml b/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/secure_hdfs_repository/40_restore.yml index c7a298d72d6c9..1a5d346562181 100644 --- a/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/secure_hdfs_repository/40_restore.yml +++ b/plugins/repository-hdfs/src/yamlRestTest/resources/rest-api-spec/test/secure_hdfs_repository/40_restore.yml @@ -51,8 +51,6 @@ - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" # Restore index - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.aliases/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.aliases/10_basic.yml index 6118453d7805e..0e1dd9fec1b1a 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.aliases/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.aliases/10_basic.yml @@ -388,8 +388,6 @@ - do: indices.close: index: test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cat.aliases: @@ -425,8 +423,6 @@ - do: indices.close: index: test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cat.aliases: {} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/10_basic.yml index d687462df5872..ce0ad990a2c21 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/10_basic.yml @@ -87,8 +87,6 @@ - do: indices.close: index: index-2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -132,8 +130,6 @@ - do: indices.close: index: index-2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -278,8 +274,6 @@ - do: indices.close: index: bar - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cat.indices: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.recovery/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.recovery/10_basic.yml index 21b307c42398d..55f7457b429ab 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.recovery/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.recovery/10_basic.yml @@ -97,8 +97,6 @@ - do: indices.close: index: index2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.segments/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.segments/10_basic.yml index 646530214bf09..94052cb4fe967 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.segments/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.segments/10_basic.yml @@ -97,8 +97,6 @@ - do: indices.close: index: index1 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: catch: bad_request diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.allocation_explain/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.allocation_explain/10_basic.yml index d045775d695b4..caf4c55e00e7e 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.allocation_explain/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.allocation_explain/10_basic.yml @@ -69,8 +69,6 @@ - do: indices.close: index: test_closed - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - match: { acknowledged: true } diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/10_basic.yml index c1c9741eb5fa3..0ffbd7fa557c3 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/10_basic.yml @@ -219,8 +219,6 @@ - do: indices.close: index: index-2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged # closing the index-2 turns the cluster health back to green @@ -297,8 +295,6 @@ - do: indices.close: index: index-2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/30_indices_options.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/30_indices_options.yml index 8756b35569135..feef05e3733f6 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/30_indices_options.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/30_indices_options.yml @@ -25,8 +25,6 @@ setup: - do: indices.close: index: index-2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cluster.health: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.state/30_expand_wildcards.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.state/30_expand_wildcards.yml index 25520b26d8302..b44e6aee33eaa 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.state/30_expand_wildcards.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.state/30_expand_wildcards.yml @@ -27,8 +27,6 @@ setup: - do: indices.close: index: test_close_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" --- "Test expand_wildcards parameter on closed, open indices and both": diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get/10_basic.yml index e2fd28e745f0e..c72f10aaa66d4 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get/10_basic.yml @@ -40,8 +40,6 @@ setup: - do: indices.close: index: test_index_3 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cluster.health: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_alias/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_alias/10_basic.yml index 63ab40f3bf578..d454fde15c824 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_alias/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_alias/10_basic.yml @@ -297,8 +297,6 @@ setup: - do: indices.close: index: test_index_2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.get_alias: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml index 853837f1375ff..0eb717f7f6c1f 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml @@ -55,8 +55,6 @@ setup: - do: indices.close: index: test-xyy - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: cluster.health: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml index 9101475fc9055..a1109e0cdfb22 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml @@ -15,8 +15,6 @@ - do: indices.close: index: test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -55,8 +53,6 @@ - do: indices.close: index: test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -113,8 +109,6 @@ - do: indices.close: index: "index_*" - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - match: { acknowledged: true } - match: { shards_acknowledged: true } diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/20_multiple_indices.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/20_multiple_indices.yml index ec71423bdc24b..222731c294597 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/20_multiple_indices.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/20_multiple_indices.yml @@ -24,8 +24,6 @@ setup: - do: indices.close: index: _all - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -57,8 +55,6 @@ setup: - do: indices.close: index: test_* - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: @@ -90,8 +86,6 @@ setup: - do: indices.close: index: '*' - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_settings/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_settings/10_basic.yml index 00cdd287f06df..0772017bcb24b 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_settings/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_settings/10_basic.yml @@ -92,8 +92,6 @@ setup: - do: indices.close: index: test-index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.put_settings: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.recovery/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.recovery/10_basic.yml index 06865d2f620e3..8ad06910ebe4d 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.recovery/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.recovery/10_basic.yml @@ -59,8 +59,6 @@ - do: indices.close: index: test_2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_cluster/10_basic_resolve_cluster.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_cluster/10_basic_resolve_cluster.yml index ba341e0d220e1..46bd0b8099e4a 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_cluster/10_basic_resolve_cluster.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_cluster/10_basic_resolve_cluster.yml @@ -20,8 +20,6 @@ setup: - do: indices.close: index: index2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" --- "Resolve cluster with indices and aliases": diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_index/10_basic_resolve_index.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_index/10_basic_resolve_index.yml index f7252d0a9a89c..b689cfba43b86 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_index/10_basic_resolve_index.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_index/10_basic_resolve_index.yml @@ -24,8 +24,6 @@ setup: - do: indices.close: index: test_index2 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.create: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.segments/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.segments/10_basic.yml index 0235d5219e47e..f0cfc4e585cc6 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.segments/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.segments/10_basic.yml @@ -105,8 +105,6 @@ - do: indices.close: index: index1 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: catch: bad_request diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/80_indices_options.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/80_indices_options.yml index 2022389a69660..1af6816d902ae 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/80_indices_options.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/80_indices_options.yml @@ -37,8 +37,6 @@ - do: indices.close: index: index_closed - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: catch: /index_closed_exception/ diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml index ecc6330a73123..133b556ce4c91 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml @@ -46,8 +46,6 @@ setup: - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: snapshot.restore: @@ -92,8 +90,6 @@ setup: - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: snapshot.restore: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml index b0e1595f3d0e3..2f177d275c099 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml @@ -120,8 +120,6 @@ teardown: - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" # Restore index - do: diff --git a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml index ac3ed826973b0..2db18f6cf1aa9 100644 --- a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml +++ b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml @@ -66,8 +66,6 @@ - do: indices.close: index: bar - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml index b4ed59a355edc..eb9278f59d0ba 100644 --- a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml +++ b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/forget_follower.yml @@ -75,8 +75,6 @@ - do: indices.close: index: follower_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml index 7beca43f02f8a..e1269e9885bfa 100644 --- a/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml +++ b/x-pack/plugin/ccr/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/ccr/index_directly_into_follower_index.yml @@ -61,8 +61,6 @@ - do: indices.close: index: bar - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - is_true: acknowledged - do: diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/monitoring/bulk/10_basic.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/monitoring/bulk/10_basic.yml index 04c7c0011e6b2..44fc75c57a16c 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/monitoring/bulk/10_basic.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/monitoring/bulk/10_basic.yml @@ -213,8 +213,6 @@ - do: indices.close: index: .monitoring-beats-* - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: catch: /export_exception/ diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/security/authz/14_cat_indices.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/security/authz/14_cat_indices.yml index 553201680f8c0..2e03907b73713 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/security/authz/14_cat_indices.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/security/authz/14_cat_indices.yml @@ -55,8 +55,6 @@ setup: - do: indices.close: index: index3 - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" --- teardown: @@ -155,8 +153,6 @@ teardown: - do: indices.close: index: index_to_monitor - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: headers: { Authorization: "Basic Y2F0X3VzZXI6Y2F0X3NlY3JldF9wYXNzd29yZA==" } # cat_user diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot/10_basic.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot/10_basic.yml index 9ba0b5e4088af..ec73081cd424b 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot/10_basic.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot/10_basic.yml @@ -54,8 +54,6 @@ setup: - do: indices.close: index : test_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: snapshot.restore: diff --git a/x-pack/qa/multi-cluster-search-security/legacy-with-basic-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic.yml b/x-pack/qa/multi-cluster-search-security/legacy-with-basic-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic.yml index f3861264d6056..45faa23becbb9 100644 --- a/x-pack/qa/multi-cluster-search-security/legacy-with-basic-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic.yml +++ b/x-pack/qa/multi-cluster-search-security/legacy-with-basic-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic.yml @@ -188,8 +188,6 @@ setup: - do: indices.close: index: closed_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.create: diff --git a/x-pack/qa/multi-cluster-search-security/legacy-with-full-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic_with_dls_fls.yml b/x-pack/qa/multi-cluster-search-security/legacy-with-full-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic_with_dls_fls.yml index 6a54396fb46b2..5489ac3217521 100644 --- a/x-pack/qa/multi-cluster-search-security/legacy-with-full-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic_with_dls_fls.yml +++ b/x-pack/qa/multi-cluster-search-security/legacy-with-full-license/src/test/resources/rest-api-spec/test/fulfilling_cluster/10_basic_with_dls_fls.yml @@ -167,8 +167,6 @@ setup: - do: indices.close: index: closed_index - allowed_warnings: - - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" - do: indices.create: From 97a3ea03573d284e9d730878313f76ef5a6081ca Mon Sep 17 00:00:00 2001 From: gmarouli Date: Thu, 12 Dec 2024 14:28:19 +0200 Subject: [PATCH 3/5] Fix tests and revert the deprecation warning to what it was. --- .../test/indices.open/10_basic.yml | 14 +++++++------ .../admin/indices/RestCloseIndexAction.java | 20 +++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml index a1109e0cdfb22..d1614df7f9037 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.open/10_basic.yml @@ -117,11 +117,14 @@ - match: { indices.index_3.closed: true } --- -"?wait_for_active_shards=index-setting is deprecated": +"?wait_for_active_shards=index-setting is removed": - requires: - cluster_features: ["gte_v8.0.0"] - reason: "required deprecation warning is only emitted in 8.0 and later" - test_runner_features: ["warnings"] + reason: "Parameter value 'index-setting' of 'wait-for-active-shards' is rejected with specialised error." + test_runner_features: [capabilities] + capabilities: + - method: POST + path: /{index}/_close + capabilities: [ wait-for-active-shards-index-setting-removed ] - do: indices.create: @@ -131,8 +134,7 @@ number_of_replicas: 0 - do: + catch: /The 'index-setting' value for parameter 'wait_for_active_shards' is the default behaviour and this configuration value is not supported anymore. Please remove 'wait_for_active_shards=index-setting'/ indices.close: index: "index_*" wait_for_active_shards: index-setting - warnings: - - "?wait_for_active_shards=index-setting is now the default behaviour; the 'index-setting' value for this parameter should no longer be used since it will become unsupported in version 9" diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index ed95d03508637..21274e3e85361 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.util.List; +import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestUtils.getAckTimeout; @@ -36,6 +37,7 @@ public class RestCloseIndexAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestCloseIndexAction.class); + public static final Set WAIT_FOR_ACTIVE_SHARDS_INDEX_SETTING_REMOVED = Set.of("wait-for-active-shards-index-setting-removed"); @Override public List routes() { @@ -70,21 +72,27 @@ private void handleIndexSettingWaitForActiveShards(final RestRequest request, fi return; } if ("index-setting".equalsIgnoreCase(waitForActiveShards)) { - String deprecationMessage = - "?wait_for_active_shards=index-setting is now the default behaviour; the 'index-setting' value for this parameter " - + "should no longer be used since it is not supported in version " - + Version.V_9_0_0.major; if (request.getRestApiVersion() == RestApiVersion.V_8) { deprecationLogger.warn( DeprecationCategory.SETTINGS, "close-index-wait_for_active_shards-index-setting", - deprecationMessage + "?wait_for_active_shards=index-setting is now the default behaviour; the 'index-setting' value for this parameter " + + "should no longer be used since it will become unsupported in version " + + Version.V_9_0_0.major ); } else { - throw new IllegalArgumentException(deprecationMessage); + throw new IllegalArgumentException( + "The 'index-setting' value for parameter 'wait_for_active_shards' is the default behaviour and this configuration" + + " value is not supported anymore. Please remove 'wait_for_active_shards=index-setting'." + ); } } else { closeIndexRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); } } + + @Override + public Set supportedCapabilities() { + return WAIT_FOR_ACTIVE_SHARDS_INDEX_SETTING_REMOVED; + } } From 25d1ddb0e17ed49480ba83c70d7b9089ff2c8d5d Mon Sep 17 00:00:00 2001 From: Mary Gouseti Date: Thu, 12 Dec 2024 14:32:55 +0200 Subject: [PATCH 4/5] Update docs/changelog/118555.yaml --- docs/changelog/118555.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docs/changelog/118555.yaml diff --git a/docs/changelog/118555.yaml b/docs/changelog/118555.yaml new file mode 100644 index 0000000000000..bd51ced326dfc --- /dev/null +++ b/docs/changelog/118555.yaml @@ -0,0 +1,6 @@ +pr: 118555 +summary: "[9.0] Remove unsupported value for the query param `wait_for_active_shards`\ + \ in close API" +area: Indices APIs +type: upgrade +issues: [] From adeaccfe5e80802bac7f8dec6f64aa2a48ca47fc Mon Sep 17 00:00:00 2001 From: Mary Gouseti Date: Thu, 19 Dec 2024 10:53:59 +0200 Subject: [PATCH 5/5] Delete docs/changelog/118555.yaml --- docs/changelog/118555.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 docs/changelog/118555.yaml diff --git a/docs/changelog/118555.yaml b/docs/changelog/118555.yaml deleted file mode 100644 index bd51ced326dfc..0000000000000 --- a/docs/changelog/118555.yaml +++ /dev/null @@ -1,6 +0,0 @@ -pr: 118555 -summary: "[9.0] Remove unsupported value for the query param `wait_for_active_shards`\ - \ in close API" -area: Indices APIs -type: upgrade -issues: []