From b46332a56b3866267ede25ff30a6c788be02a94d Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 9 Mar 2020 14:29:43 +0000 Subject: [PATCH] Remove support for settings in restore requests The unused `settings` value was deprecated in #53268 so this commit removes it. --- .../migration/migrate_8_0/snapshots.asciidoc | 7 +++++++ .../snapshots/restore/RestoreSnapshotRequest.java | 12 +----------- .../snapshots/SnapshotRequestsTests.java | 3 --- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/reference/migration/migrate_8_0/snapshots.asciidoc b/docs/reference/migration/migrate_8_0/snapshots.asciidoc index 6a5b319616096..9e52ddb770563 100644 --- a/docs/reference/migration/migrate_8_0/snapshots.asciidoc +++ b/docs/reference/migration/migrate_8_0/snapshots.asciidoc @@ -94,3 +94,10 @@ breaking change was made necessary by https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/[AWS's announcement] that the path-style access pattern is deprecated and will be unsupported on buckets created after September 30th 2020. + +[float] +==== Restore requests no longer accept settings + +In earlier versions, you could pass both `settings` and `index_settings` in the +body of a restore snapshot request, but the `settings` value was ignored. The +restore snapshot API now rejects requests that include a `settings` value. diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java index 1c6d72c948b14..5984c7276add7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.cluster.snapshots.restore; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.ElasticsearchGenerationException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; @@ -28,7 +27,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -43,9 +41,9 @@ import java.util.Objects; import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; -import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue; /** @@ -53,8 +51,6 @@ */ public class RestoreSnapshotRequest extends MasterNodeRequest implements ToXContentObject { - private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LogManager.getLogger(RestoreSnapshotRequest.class)); - private String snapshot; private String repository; private String[] indices = Strings.EMPTY_ARRAY; @@ -459,12 +455,6 @@ public RestoreSnapshotRequest source(Map source) { } } else if (name.equals("partial")) { partial(nodeBooleanValue(entry.getValue(), "partial")); - } else if (name.equals("settings")) { - if (!(entry.getValue() instanceof Map)) { - throw new IllegalArgumentException("malformed settings section"); - } - DEPRECATION_LOGGER.deprecatedAndMaybeLog("RestoreSnapshotRequest#settings", - "specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version"); } else if (name.equals("include_global_state")) { includeGlobalState = nodeBooleanValue(entry.getValue(), "include_global_state"); } else if (name.equals("include_aliases")) { diff --git a/server/src/test/java/org/elasticsearch/snapshots/SnapshotRequestsTests.java b/server/src/test/java/org/elasticsearch/snapshots/SnapshotRequestsTests.java index f70bfdcae400b..ee74c37fbd401 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/SnapshotRequestsTests.java +++ b/server/src/test/java/org/elasticsearch/snapshots/SnapshotRequestsTests.java @@ -66,7 +66,6 @@ public void testRestoreSnapshotRequestParsing() throws IOException { builder.field("rename_replacement", "rename-to"); boolean partial = randomBoolean(); builder.field("partial", partial); - builder.startObject("settings").field("set1", "val1").endObject(); builder.startObject("index_settings").field("set1", "val2").endObject(); if (randomBoolean()) { builder.field("ignore_index_settings", "set2,set3"); @@ -96,8 +95,6 @@ public void testRestoreSnapshotRequestParsing() throws IOException { ? indicesOptions.ignoreUnavailable() : IndicesOptions.strictExpandOpen().ignoreUnavailable(); assertEquals(expectedIgnoreAvailable, request.indicesOptions().ignoreUnavailable()); - - assertWarnings("specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version"); } public void testCreateSnapshotRequestParsing() throws IOException {