Skip to content

Commit

Permalink
Remove support for wait_for_active_shards=index-setting in index clos…
Browse files Browse the repository at this point in the history
…e API

Specifiying `wait_for_active_shards=index-setting` was deprecared in elastic#67158 (8.0).
It's redundant since it's the default behaviour in 8.x
  • Loading branch information
arteam committed Oct 14, 2024
1 parent a262eb6 commit a74b605
Show file tree
Hide file tree
Showing 36 changed files with 44 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
- 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 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@
- 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:
Expand Down Expand Up @@ -425,8 +424,7 @@
- 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: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@
- 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:
Expand Down Expand Up @@ -132,8 +131,7 @@
- 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:
Expand Down Expand Up @@ -278,8 +276,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
- 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 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@
- 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
Expand Down Expand Up @@ -297,8 +296,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ 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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
- 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:
Expand Down Expand Up @@ -55,8 +54,7 @@
- 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:
Expand Down Expand Up @@ -113,8 +111,7 @@
- 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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -57,8 +55,7 @@ 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:
Expand Down Expand Up @@ -90,8 +87,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
- 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ 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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
- 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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ 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:
Expand Down Expand Up @@ -92,8 +91,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@

package org.elasticsearch.rest.action.admin.indices;

import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.node.NodeClient;
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.rest.BaseRestHandler;
Expand Down Expand Up @@ -55,16 +53,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions()));
String waitForActiveShards = request.param("wait_for_active_shards");
if ("index-setting".equalsIgnoreCase(waitForActiveShards)) {
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"close-index-wait_for_active_shards-index-setting",
"?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
throw new IllegalArgumentException("wait_for_active_shards=index-setting shouldn't be used");
// TODO in v10:
// - remove the IllegalArgumentException here
} else if (waitForActiveShards != null) {
Expand Down
Loading

0 comments on commit a74b605

Please sign in to comment.