Browse Source

Undo transient settings deprecation (#80558)

This change removes the deprecation warning when calling
the cluster settings APIs with transient settings.

Relates to #80556
Nikola Grcevski 4 years ago
parent
commit
3308dd5c00

+ 0 - 3
docs/reference/cluster/update-settings.asciidoc

@@ -61,7 +61,6 @@ PUT /_cluster/settings?flat_settings=true
   }
   }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
-// TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
 
 
 The response to an update returns the changed setting, as in this response to
 The response to an update returns the changed setting, as in this response to
 the transient example:
 the transient example:
@@ -90,7 +89,6 @@ PUT /_cluster/settings
   }
   }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
-// TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
 
 
 
 
 The response does not include settings that have been reset:
 The response does not include settings that have been reset:
@@ -118,4 +116,3 @@ PUT /_cluster/settings
   }
   }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
-// TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]

+ 0 - 2
docs/reference/migration/transient-settings-migration-guide.asciidoc

@@ -12,7 +12,6 @@ PUT _cluster/settings
   }
   }
 }
 }
 ----
 ----
-// TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
 ////
 ////
 
 
 Transient cluster settings are deprecated. Previously, you could use transient
 Transient cluster settings are deprecated. Previously, you could use transient
@@ -77,7 +76,6 @@ PUT _cluster/settings
 }
 }
 ----
 ----
 // TEST[continued]
 // TEST[continued]
-// TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
 
 
 . Use the <<cluster-get-settings,cluster get settings API>> to confirm your
 . Use the <<cluster-get-settings,cluster get settings API>> to confirm your
 cluster has no remaining transient settings.
 cluster has no remaining transient settings.

+ 1 - 0
rest-api-spec/build.gradle

@@ -82,6 +82,7 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->
   task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
   task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
   task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
   task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
   task.skipTest("migration/10_get_feature_upgrade_status/Get feature upgrade status", "Awaits backport")
   task.skipTest("migration/10_get_feature_upgrade_status/Get feature upgrade status", "Awaits backport")
+  task.skipTest("cluster.put_settings/10_basic/Test put and reset transient settings", "Awaits backport")
 
 
   task.replaceValueInMatch("_type", "_doc")
   task.replaceValueInMatch("_type", "_doc")
   task.addAllowedWarningRegex("\\[types removal\\].*")
   task.addAllowedWarningRegex("\\[types removal\\].*")

+ 3 - 3
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.put_settings/10_basic.yml

@@ -3,10 +3,10 @@
   - skip:
   - skip:
       version: " - 7.99.99"
       version: " - 7.99.99"
       reason:  "transient settings deprecation"
       reason:  "transient settings deprecation"
-      features: "warnings"
+      features: "allowed_warnings"
 
 
   - do:
   - do:
-      warnings:
+      allowed_warnings:
         - "[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead."
         - "[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead."
       cluster.put_settings:
       cluster.put_settings:
         body:
         body:
@@ -23,7 +23,7 @@
   - match: {transient: {cluster.routing.allocation.enable: "none"}}
   - match: {transient: {cluster.routing.allocation.enable: "none"}}
 
 
   - do:
   - do:
-      warnings:
+      allowed_warnings:
         - "[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead."
         - "[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead."
       cluster.put_settings:
       cluster.put_settings:
         body:
         body:

+ 1 - 15
server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java

@@ -11,8 +11,6 @@ package org.elasticsearch.rest.action.admin.cluster;
 import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
 import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
 import org.elasticsearch.client.Requests;
 import org.elasticsearch.client.Requests;
 import org.elasticsearch.client.node.NodeClient;
 import org.elasticsearch.client.node.NodeClient;
-import org.elasticsearch.common.logging.DeprecationCategory;
-import org.elasticsearch.common.logging.DeprecationLogger;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.rest.BaseRestHandler;
 import org.elasticsearch.rest.BaseRestHandler;
 import org.elasticsearch.rest.RestRequest;
 import org.elasticsearch.rest.RestRequest;
@@ -27,10 +25,6 @@ import java.util.Set;
 import static org.elasticsearch.rest.RestRequest.Method.PUT;
 import static org.elasticsearch.rest.RestRequest.Method.PUT;
 
 
 public class RestClusterUpdateSettingsAction extends BaseRestHandler {
 public class RestClusterUpdateSettingsAction extends BaseRestHandler {
-    private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestClusterUpdateSettingsAction.class);
-    static final String TRANSIENT_SETTINGS_DEPRECATION_MESSAGE = "[transient settings removal]"
-        + " Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.";
-
     private static final String PERSISTENT = "persistent";
     private static final String PERSISTENT = "persistent";
     private static final String TRANSIENT = "transient";
     private static final String TRANSIENT = "transient";
 
 
@@ -57,15 +51,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler {
             source = parser.map();
             source = parser.map();
         }
         }
         if (source.containsKey(TRANSIENT)) {
         if (source.containsKey(TRANSIENT)) {
-            Map<String, ?> transientSettings = (Map<String, ?>) source.get(TRANSIENT);
-
-            // We check for empty transient settings map because ClusterUpdateSettingsRequest initializes
-            // each of the settings to an empty collection. When the RestClient is used, we'll get an empty
-            // transient settings map, even if we never set any transient settings.
-            if (transientSettings.isEmpty() == false) {
-                deprecationLogger.warn(DeprecationCategory.SETTINGS, "transient_settings", TRANSIENT_SETTINGS_DEPRECATION_MESSAGE);
-            }
-            clusterUpdateSettingsRequest.transientSettings(transientSettings);
+            clusterUpdateSettingsRequest.transientSettings((Map<String, ?>) source.get(TRANSIENT));
         }
         }
         if (source.containsKey(PERSISTENT)) {
         if (source.containsKey(PERSISTENT)) {
             clusterUpdateSettingsRequest.persistentSettings((Map<String, ?>) source.get(PERSISTENT));
             clusterUpdateSettingsRequest.persistentSettings((Map<String, ?>) source.get(PERSISTENT));

+ 1 - 2
test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

@@ -1059,8 +1059,7 @@ public abstract class ESRestTestCase extends ESTestCase {
                 } else if (warnings.size() > 1) {
                 } else if (warnings.size() > 1) {
                     return true;
                     return true;
                 } else {
                 } else {
-                    return warnings.get(0).startsWith("[transient settings removal]") == false
-                        && warnings.get(0).contains("xpack.monitoring") == false;
+                    return warnings.get(0).contains("xpack.monitoring") == false;
                 }
                 }
             }));
             }));
 
 

+ 0 - 27
x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java

@@ -1,27 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-package org.elasticsearch.xpack.deprecation;
-
-import org.elasticsearch.cluster.ClusterState;
-import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
-
-public class ClusterDeprecationChecks {
-    static DeprecationIssue checkTransientSettingsExistence(ClusterState state) {
-        if (state.metadata().transientSettings().isEmpty() == false) {
-            return new DeprecationIssue(
-                DeprecationIssue.Level.WARNING,
-                "Transient cluster settings are deprecated",
-                "https://ela.st/es-deprecation-7-transient-cluster-settings",
-                "Use persistent settings to configure your cluster.",
-                false,
-                null
-            );
-        }
-        return null;
-    }
-}

+ 1 - 3
x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

@@ -36,9 +36,7 @@ public class DeprecationChecks {
 
 
     private DeprecationChecks() {}
     private DeprecationChecks() {}
 
 
-    static List<Function<ClusterState, DeprecationIssue>> CLUSTER_SETTINGS_CHECKS = List.of(
-        ClusterDeprecationChecks::checkTransientSettingsExistence
-    );
+    static List<Function<ClusterState, DeprecationIssue>> CLUSTER_SETTINGS_CHECKS = Collections.emptyList();
 
 
     static List<BiFunction<Settings, PluginsAndModules, DeprecationIssue>> NODE_SETTINGS_CHECKS = List.of(
     static List<BiFunction<Settings, PluginsAndModules, DeprecationIssue>> NODE_SETTINGS_CHECKS = List.of(
         NodeDeprecationChecks::checkSharedDataPathSetting,
         NodeDeprecationChecks::checkSharedDataPathSetting,

+ 0 - 56
x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java

@@ -1,56 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.xpack.deprecation;
-
-import org.elasticsearch.cluster.ClusterName;
-import org.elasticsearch.cluster.ClusterState;
-import org.elasticsearch.cluster.metadata.Metadata;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
-
-import static org.hamcrest.Matchers.equalTo;
-
-public class ClusterDeprecationChecksTests extends ESTestCase {
-
-    public void testCheckTransientSettingsExistence() {
-        Settings persistentSettings = Settings.builder().put("xpack.monitoring.collection.enabled", true).build();
-
-        Settings transientSettings = Settings.builder()
-            .put("indices.recovery.max_bytes_per_sec", "20mb")
-            .put("action.auto_create_index", true)
-            .put("cluster.routing.allocation.enable", "primaries")
-            .build();
-        Metadata metadataWithTransientSettings = Metadata.builder()
-            .persistentSettings(persistentSettings)
-            .transientSettings(transientSettings)
-            .build();
-
-        ClusterState badState = ClusterState.builder(new ClusterName("test")).metadata(metadataWithTransientSettings).build();
-        DeprecationIssue issue = ClusterDeprecationChecks.checkTransientSettingsExistence(badState);
-        assertThat(
-            issue,
-            equalTo(
-                new DeprecationIssue(
-                    DeprecationIssue.Level.WARNING,
-                    "Transient cluster settings are deprecated",
-                    "https://ela.st/es-deprecation-7-transient-cluster-settings",
-                    "Use persistent settings to configure your cluster.",
-                    false,
-                    null
-                )
-            )
-        );
-
-        persistentSettings = Settings.builder().put("indices.recovery.max_bytes_per_sec", "20mb").build();
-        Metadata metadataWithoutTransientSettings = Metadata.builder().persistentSettings(persistentSettings).build();
-
-        ClusterState okState = ClusterState.builder(new ClusterName("test")).metadata(metadataWithoutTransientSettings).build();
-        issue = ClusterDeprecationChecks.checkTransientSettingsExistence(okState);
-        assertNull(issue);
-    }
-}