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 278353908ace0..04b558e7d1e98 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 @@ -97,6 +97,7 @@ private DeprecationChecks() { NodeDeprecationChecks::checkImplicitlyDisabledSecurityOnBasicAndTrial, NodeDeprecationChecks::checkSearchRemoteSettings, NodeDeprecationChecks::checkMonitoringExporterPassword, + NodeDeprecationChecks::checkJoinTimeoutSetting, NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting, NodeDeprecationChecks::checkClusterRoutingRequireSetting, NodeDeprecationChecks::checkClusterRoutingIncludeSetting, 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 20f17b5bb2116..d0e1550f0400b 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,6 +11,7 @@ import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules; import org.elasticsearch.bootstrap.BootstrapSettings; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.cluster.coordination.JoinHelper; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodeRole; import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings; @@ -597,6 +598,17 @@ static DeprecationIssue checkMonitoringExporterPassword( return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } + static DeprecationIssue checkJoinTimeoutSetting(final Settings settings, + final PluginsAndModules pluginsAndModules, + final ClusterState clusterState, + final XPackLicenseState licenseState) { + return checkRemovedSetting(settings, + JoinHelper.JOIN_TIMEOUT_SETTING, + "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_cluster_changes", + DeprecationIssue.Level.CRITICAL + ); + } + static DeprecationIssue checkSearchRemoteSettings( 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 3e1cc9b075d52..cf242eb3c8e50 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 @@ -42,6 +42,7 @@ import java.util.Locale; import java.util.stream.Collectors; +import static org.elasticsearch.cluster.coordination.JoinHelper.JOIN_TIMEOUT_SETTING; import static org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING; import static org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider.INDEX_ROUTING_EXCLUDE_SETTING; import static org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider.INDEX_ROUTING_INCLUDE_SETTING; @@ -804,6 +805,37 @@ public void testMonitoringExporterPassword() { assertThat(issue, nullValue()); } + public void testJoinTimeoutSetting() { + String settingValue = randomTimeValue(1, 1000, new String[]{"d", "h", "ms", "s", "m"}); + String settingKey = JOIN_TIMEOUT_SETTING.getKey(); + final Settings nodeSettings = Settings.builder().put(settingKey, settingValue).build(); + final XPackLicenseState licenseState = new XPackLicenseState(Settings.EMPTY, () -> 0); + final ClusterState clusterState = ClusterState.EMPTY_STATE; + final DeprecationIssue expectedIssue = new DeprecationIssue(DeprecationIssue.Level.CRITICAL, + String.format(Locale.ROOT, + "setting [%s] is deprecated and will be removed in the next major version", + settingKey), + "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_cluster_changes", + String.format(Locale.ROOT, + "the setting [%s] is currently set to [%s], remove this setting", + settingKey, + settingValue), + false, null + ); + + assertThat( + NodeDeprecationChecks.checkJoinTimeoutSetting(nodeSettings, null, clusterState, licenseState), + equalTo(expectedIssue) + ); + + final String expectedWarning = String.format(Locale.ROOT, + "[%s] setting was deprecated in Elasticsearch and will be removed in a future release! " + + "See the breaking changes documentation for the next major version.", + settingKey); + + assertWarnings(expectedWarning); + } + public void testCheckSearchRemoteSettings() { // test for presence of deprecated exporter passwords final int numClusters = randomIntBetween(1, 3);