Skip to content

Commit

Permalink
Adding a deprecation info check for cluster.join.timeout (#76944)
Browse files Browse the repository at this point in the history
The cluster.join.timeout setting has been removed in 8.0. This commit adds a deprecation info
check for that setting.
Relates #42404 #60873
masseyke authored Sep 2, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 744b35b commit 0363933
Showing 3 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ private DeprecationChecks() {
NodeDeprecationChecks::checkImplicitlyDisabledSecurityOnBasicAndTrial,
NodeDeprecationChecks::checkSearchRemoteSettings,
NodeDeprecationChecks::checkMonitoringExporterPassword,
NodeDeprecationChecks::checkJoinTimeoutSetting,
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
NodeDeprecationChecks::checkClusterRoutingRequireSetting,
NodeDeprecationChecks::checkClusterRoutingIncludeSetting,
Original file line number Diff line number Diff line change
@@ -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,
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 0363933

Please sign in to comment.