Skip to content

Commit bfcd8dc

Browse files
authored
Remove support for settings in restore requests (#53284)
The unused `settings` value was deprecated in #53268 so this commit removes it.
1 parent 111d7c2 commit bfcd8dc

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

docs/reference/migration/migrate_8_0/snapshots.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,10 @@ breaking change was made necessary by
9494
https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/[AWS's
9595
announcement] that the path-style access pattern is deprecated and will be
9696
unsupported on buckets created after September 30th 2020.
97+
98+
[float]
99+
==== Restore requests no longer accept settings
100+
101+
In earlier versions, you could pass both `settings` and `index_settings` in the
102+
body of a restore snapshot request, but the `settings` value was ignored. The
103+
restore snapshot API now rejects requests that include a `settings` value.

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.action.admin.cluster.snapshots.restore;
2121

22-
import org.apache.logging.log4j.LogManager;
2322
import org.elasticsearch.ElasticsearchGenerationException;
2423
import org.elasticsearch.Version;
2524
import org.elasticsearch.action.ActionRequestValidationException;
@@ -28,7 +27,6 @@
2827
import org.elasticsearch.common.Strings;
2928
import org.elasticsearch.common.io.stream.StreamInput;
3029
import org.elasticsearch.common.io.stream.StreamOutput;
31-
import org.elasticsearch.common.logging.DeprecationLogger;
3230
import org.elasticsearch.common.settings.Settings;
3331
import org.elasticsearch.common.xcontent.ToXContentObject;
3432
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -43,18 +41,16 @@
4341
import java.util.Objects;
4442

4543
import static org.elasticsearch.action.ValidateActions.addValidationError;
44+
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
4645
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
4746
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
48-
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
4947
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
5048

5149
/**
5250
* Restore snapshot request
5351
*/
5452
public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotRequest> implements ToXContentObject {
5553

56-
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LogManager.getLogger(RestoreSnapshotRequest.class));
57-
5854
private String snapshot;
5955
private String repository;
6056
private String[] indices = Strings.EMPTY_ARRAY;
@@ -459,12 +455,6 @@ public RestoreSnapshotRequest source(Map<String, Object> source) {
459455
}
460456
} else if (name.equals("partial")) {
461457
partial(nodeBooleanValue(entry.getValue(), "partial"));
462-
} else if (name.equals("settings")) {
463-
if (!(entry.getValue() instanceof Map)) {
464-
throw new IllegalArgumentException("malformed settings section");
465-
}
466-
DEPRECATION_LOGGER.deprecatedAndMaybeLog("RestoreSnapshotRequest#settings",
467-
"specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version");
468458
} else if (name.equals("include_global_state")) {
469459
includeGlobalState = nodeBooleanValue(entry.getValue(), "include_global_state");
470460
} else if (name.equals("include_aliases")) {

server/src/test/java/org/elasticsearch/snapshots/SnapshotRequestsTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public void testRestoreSnapshotRequestParsing() throws IOException {
6666
builder.field("rename_replacement", "rename-to");
6767
boolean partial = randomBoolean();
6868
builder.field("partial", partial);
69-
builder.startObject("settings").field("set1", "val1").endObject();
7069
builder.startObject("index_settings").field("set1", "val2").endObject();
7170
if (randomBoolean()) {
7271
builder.field("ignore_index_settings", "set2,set3");
@@ -96,8 +95,6 @@ public void testRestoreSnapshotRequestParsing() throws IOException {
9695
? indicesOptions.ignoreUnavailable()
9796
: IndicesOptions.strictExpandOpen().ignoreUnavailable();
9897
assertEquals(expectedIgnoreAvailable, request.indicesOptions().ignoreUnavailable());
99-
100-
assertWarnings("specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version");
10198
}
10299

103100
public void testCreateSnapshotRequestParsing() throws IOException {

0 commit comments

Comments
 (0)