Skip to content

Commit a15a041

Browse files
committed
Remove copy_settings flag from resize operations
This commit removes the `copy_settings` flag for shrink and split operations. The flag was introduced in elastic#30255 and the default value from now onwards is for the settings to be copied.
1 parent 3bf8e24 commit a15a041

File tree

7 files changed

+0
-121
lines changed

7 files changed

+0
-121
lines changed

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

-3
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ public void testShrink() throws IOException {
381381
client().performRequest(updateSettingsRequest);
382382

383383
Request shrinkIndexRequest = new Request("PUT", "/" + index + "/_shrink/" + shrunkenIndex);
384-
if (getOldClusterVersion().onOrAfter(Version.V_6_4_0)) {
385-
shrinkIndexRequest.addParameter("copy_settings", "true");
386-
}
387384
shrinkIndexRequest.setJsonEntity("{\"settings\": {\"index.number_of_shards\": 1}}");
388385
client().performRequest(shrinkIndexRequest);
389386

rest-api-spec/src/main/resources/rest-api-spec/api/indices.shrink.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
}
1919
},
2020
"params": {
21-
"copy_settings": {
22-
"type" : "boolean",
23-
"description" : "whether or not to copy settings from the source index (defaults to false)"
24-
},
2521
"timeout": {
2622
"type" : "time",
2723
"description" : "Explicit operation timeout"

rest-api-spec/src/main/resources/rest-api-spec/api/indices.split.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
}
1919
},
2020
"params": {
21-
"copy_settings": {
22-
"type" : "boolean",
23-
"description" : "whether or not to copy settings from the source index (defaults to false)"
24-
},
2521
"timeout": {
2622
"type" : "time",
2723
"description" : "Explicit operation timeout"

rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/30_copy_settings.yml

-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@
4343
target: "copy-settings-target"
4444
wait_for_active_shards: 1
4545
master_timeout: 10s
46-
copy_settings: true
4746
body:
4847
settings:
4948
index.number_of_replicas: 0
5049
index.merge.scheduler.max_thread_count: 2
51-
warnings:
52-
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"
5350

5451
- do:
5552
cluster.health:
@@ -99,7 +96,6 @@
9996
target: "explicit-no-copy-settings-target"
10097
wait_for_active_shards: 1
10198
master_timeout: 10s
102-
copy_settings: false
10399
body:
104100
settings:
105101
index.number_of_replicas: 0

rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/30_copy_settings.yml

-4
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@
4444
target: "copy-settings-target"
4545
wait_for_active_shards: 1
4646
master_timeout: 10s
47-
copy_settings: true
4847
body:
4948
settings:
5049
index.number_of_replicas: 0
5150
index.number_of_shards: 2
5251
index.merge.scheduler.max_thread_count: 2
53-
warnings:
54-
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"
5552

5653

5754
- do:
@@ -102,7 +99,6 @@
10299
target: "explicit-no-copy-settings-target"
103100
wait_for_active_shards: 1
104101
master_timeout: 10s
105-
copy_settings: false
106102
body:
107103
settings:
108104
index.number_of_replicas: 0

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java

-25
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,10 @@
1919

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

22-
import org.apache.logging.log4j.Logger;
23-
import org.apache.logging.log4j.LogManager;
24-
import org.elasticsearch.Version;
2522
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
2623
import org.elasticsearch.action.admin.indices.shrink.ResizeType;
2724
import org.elasticsearch.action.support.ActiveShardCount;
2825
import org.elasticsearch.client.node.NodeClient;
29-
import org.elasticsearch.common.Booleans;
30-
import org.elasticsearch.common.logging.DeprecationLogger;
3126
import org.elasticsearch.common.settings.Settings;
3227
import org.elasticsearch.rest.BaseRestHandler;
3328
import org.elasticsearch.rest.RestController;
@@ -37,8 +32,6 @@
3732
import java.io.IOException;
3833

3934
public abstract class RestResizeHandler extends BaseRestHandler {
40-
private static final Logger logger = LogManager.getLogger(RestResizeHandler.class);
41-
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
4235

4336
RestResizeHandler(final Settings settings) {
4437
super(settings);
@@ -53,24 +46,6 @@ public abstract class RestResizeHandler extends BaseRestHandler {
5346
public final RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
5447
final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index"));
5548
resizeRequest.setResizeType(getResizeType());
56-
// copy_settings should be removed in Elasticsearch 8.0.0; cf. https://github.com/elastic/elasticsearch/issues/28347
57-
assert Version.CURRENT.major < 8;
58-
final String rawCopySettings = request.param("copy_settings");
59-
final Boolean copySettings;
60-
if (rawCopySettings == null) {
61-
copySettings = resizeRequest.getCopySettings();
62-
} else {
63-
if (rawCopySettings.isEmpty()) {
64-
copySettings = true;
65-
} else {
66-
copySettings = Booleans.parseBoolean(rawCopySettings);
67-
if (copySettings == false) {
68-
throw new IllegalArgumentException("parameter [copy_settings] can not be explicitly set to [false]");
69-
}
70-
}
71-
deprecationLogger.deprecated("parameter [copy_settings] is deprecated and will be removed in 8.0.0");
72-
}
73-
resizeRequest.setCopySettings(copySettings);
7449
request.applyContentParser(resizeRequest::fromXContent);
7550
resizeRequest.timeout(request.paramAsTime("timeout", resizeRequest.timeout()));
7651
resizeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", resizeRequest.masterNodeTimeout()));

server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandlerTests.java

-77
This file was deleted.

0 commit comments

Comments
 (0)