From e30f98339c4b30601f360ed7009942dc502afd2d Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 24 Mar 2020 22:11:43 -0400 Subject: [PATCH 1/3] Add cluster.remote.connect to deprecation info API This setting was recently deprecated in favor of node.remote_cluster_client. This commit adds this setting to the deprecation info API. --- .../xpack/deprecation/DeprecationChecks.java | 3 ++- .../deprecation/NodeDeprecationChecks.java | 13 +++++++++++ .../NodeDeprecationChecksTests.java | 23 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java index bc5ea2558c3cf..80e53db4b6914 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java @@ -47,7 +47,8 @@ private DeprecationChecks() { NodeDeprecationChecks::checkMissingRealmOrders, NodeDeprecationChecks::checkUniqueRealmOrders, (settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerQueueSize(settings), - (settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerSize(settings) + (settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerSize(settings), + NodeDeprecationChecks::checkClusterRemoteConnectSetting )); static List> INDEX_SETTINGS_CHECKS = diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index f370ab26e6d38..2d0f3363ad6cc 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -11,7 +11,10 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.env.Environment; +import org.elasticsearch.node.Node; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.threadpool.FixedExecutorBuilder; +import org.elasticsearch.transport.RemoteClusterService; import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; import org.elasticsearch.xpack.core.security.authc.RealmSettings; @@ -117,6 +120,16 @@ private static DeprecationIssue checkThreadPoolListenerSetting(final String name "https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool"); } + public static DeprecationIssue checkClusterRemoteConnectSetting(final Settings settings, final PluginsAndModules pluginsAndModules) { + return checkDeprecatedSetting( + settings, + pluginsAndModules, + RemoteClusterService.ENABLE_REMOTE_CLUSTERS, + Node.NODE_REMOTE_CLUSTER_CLIENT, + "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.7.html#deprecate-cluster-remote-connect" + ); + } + private static DeprecationIssue checkDeprecatedSetting( final Settings settings, final PluginsAndModules pluginsAndModules, diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 19b5931c8f319..a0baae8814689 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -11,7 +11,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.env.Environment; +import org.elasticsearch.node.Node; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.transport.RemoteClusterService; import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; import org.elasticsearch.xpack.core.security.authc.RealmConfig; import org.elasticsearch.xpack.core.security.authc.RealmSettings; @@ -176,6 +178,27 @@ public void testThreadPoolListenerSize() { assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.size"}); } + public void testClusterRemoteConnectSetting() { + final boolean value = randomBoolean(); + final Settings settings = Settings.builder().put(RemoteClusterService.ENABLE_REMOTE_CLUSTERS.getKey(), value).build(); + final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList()); + final List issues = + DeprecationChecks.filterChecks(DeprecationChecks.NODE_SETTINGS_CHECKS, c -> c.apply(settings, pluginsAndModules)); + final DeprecationIssue expected = new DeprecationIssue( + DeprecationIssue.Level.CRITICAL, + "setting [cluster.remote.connect] is deprecated and will be removed in the next major version", + "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.7.html#deprecate-cluster-remote-connect", + String.format( + Locale.ROOT, + "the setting [%s] is currently set to [%b], instead set [%s] to [%1$b]", + RemoteClusterService.ENABLE_REMOTE_CLUSTERS.getKey(), + value, + Node.NODE_REMOTE_CLUSTER_CLIENT.getKey() + )); + assertThat(issues, contains(expected)); + assertSettingDeprecationsAndWarnings(new Setting[]{RemoteClusterService.ENABLE_REMOTE_CLUSTERS}); + } + public void testRemovedSettingNotSet() { final Settings settings = Settings.EMPTY; final Setting removedSetting = Setting.simpleString("node.removed_setting"); From dd1ef81a6b42c1a181c0ae421ae180bc885ab817 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 24 Mar 2020 23:58:08 -0400 Subject: [PATCH 2/3] Fix imports --- .../elasticsearch/xpack/deprecation/NodeDeprecationChecks.java | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index 2d0f3363ad6cc..44abf52d26d2a 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.env.Environment; import org.elasticsearch.node.Node; -import org.elasticsearch.plugins.Plugin; import org.elasticsearch.threadpool.FixedExecutorBuilder; import org.elasticsearch.transport.RemoteClusterService; import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; From d8b0c23f5e9689c3e9986ab7b145f4ce64138cfd Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 25 Mar 2020 08:08:10 -0400 Subject: [PATCH 3/3] Fix tests --- .../xpack/deprecation/NodeDeprecationChecksTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index a0baae8814689..367e8a1e6dbd7 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -186,11 +186,11 @@ public void testClusterRemoteConnectSetting() { DeprecationChecks.filterChecks(DeprecationChecks.NODE_SETTINGS_CHECKS, c -> c.apply(settings, pluginsAndModules)); final DeprecationIssue expected = new DeprecationIssue( DeprecationIssue.Level.CRITICAL, - "setting [cluster.remote.connect] is deprecated and will be removed in the next major version", + "setting [cluster.remote.connect] is deprecated in favor of setting [node.remote_cluster_client]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.7.html#deprecate-cluster-remote-connect", String.format( Locale.ROOT, - "the setting [%s] is currently set to [%b], instead set [%s] to [%1$b]", + "the setting [%s] is currently set to [%b], instead set [%s] to [%2$b]", RemoteClusterService.ENABLE_REMOTE_CLUSTERS.getKey(), value, Node.NODE_REMOTE_CLUSTER_CLIENT.getKey()