Skip to content

Commit 8b5b762

Browse files
authored
Adding two missing entries to the deprecation info api (#80290) (#80307)
Adding indices.lifecycle.step.master_timeout and xpack.eql.enabled to the deprecation info API. These two checks were also added to the 7.16 line in #80233.
1 parent a7818e0 commit 8b5b762

File tree

4 files changed

+119
-20
lines changed

4 files changed

+119
-20
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class LifecycleSettings {
7676
TimeValue.timeValueSeconds(30),
7777
Setting.Property.Dynamic,
7878
Setting.Property.NodeScope,
79-
Setting.Property.Deprecated
79+
Setting.Property.DeprecatedWarning
8080
);
8181
// This setting configures how much time since step_time should ILM wait for a condition to be met. After the threshold wait time has
8282
// elapsed ILM will likely stop waiting and go to the next step.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ private DeprecationChecks() {}
8282
NodeDeprecationChecks::checkScriptContextCompilationsRateLimitSetting,
8383
NodeDeprecationChecks::checkScriptContextCacheSizeSetting,
8484
NodeDeprecationChecks::checkScriptContextCacheExpirationSetting,
85-
NodeDeprecationChecks::checkEnforceDefaultTierPreferenceSetting
85+
NodeDeprecationChecks::checkEnforceDefaultTierPreferenceSetting,
86+
NodeDeprecationChecks::checkLifecyleStepMasterTimeoutSetting,
87+
NodeDeprecationChecks::checkEqlEnabledSetting
8688
);
8789

8890
static List<Function<IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS = List.of(

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
import org.elasticsearch.common.settings.SecureSetting;
1414
import org.elasticsearch.common.settings.Setting;
1515
import org.elasticsearch.common.settings.Settings;
16+
import org.elasticsearch.core.TimeValue;
1617
import org.elasticsearch.env.Environment;
1718
import org.elasticsearch.script.ScriptService;
1819
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
20+
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
1921
import org.elasticsearch.xpack.core.monitoring.MonitoringDeprecatedSettings;
2022
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
2123
import org.elasticsearch.xpack.core.security.authc.RealmSettings;
@@ -59,23 +61,32 @@ static DeprecationIssue checkDeprecatedSetting(
5961
}
6062

6163
static DeprecationIssue checkRemovedSetting(final Settings settings, final Setting<?> removedSetting, final String url) {
64+
return checkRemovedSetting(settings, removedSetting, url, null, DeprecationIssue.Level.CRITICAL);
65+
}
66+
67+
static DeprecationIssue checkRemovedSetting(
68+
final Settings settings,
69+
final Setting<?> removedSetting,
70+
final String url,
71+
String additionalDetailMessage,
72+
DeprecationIssue.Level deprecationLevel
73+
) {
6274
if (removedSetting.exists(settings) == false) {
6375
return null;
6476
}
6577
final String removedSettingKey = removedSetting.getKey();
66-
final String value = removedSetting.get(settings).toString();
67-
final String message = String.format(
68-
Locale.ROOT,
69-
"setting [%s] is deprecated and will be removed in the next major version",
70-
removedSettingKey
71-
);
72-
final String details = String.format(
73-
Locale.ROOT,
74-
"the setting [%s] is currently set to [%s], remove this setting",
75-
removedSettingKey,
76-
value
77-
);
78-
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
78+
Object removedSettingValue = removedSetting.get(settings);
79+
String value;
80+
if (removedSettingValue instanceof TimeValue) {
81+
value = ((TimeValue) removedSettingValue).getStringRep();
82+
} else {
83+
value = removedSettingValue.toString();
84+
}
85+
final String message = String.format(Locale.ROOT, "Setting [%s] is deprecated", removedSettingKey);
86+
final String details = additionalDetailMessage == null
87+
? String.format(Locale.ROOT, "Remove the [%s] setting.", removedSettingKey)
88+
: String.format(Locale.ROOT, "Remove the [%s] setting. %s", removedSettingKey, additionalDetailMessage);
89+
return new DeprecationIssue(deprecationLevel, message, url, details, false, null);
7990
}
8091

8192
static DeprecationIssue checkSharedDataPathSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
@@ -565,4 +576,33 @@ static DeprecationIssue checkEnforceDefaultTierPreferenceSetting(final Settings
565576
return null;
566577
}
567578

579+
static DeprecationIssue checkLifecyleStepMasterTimeoutSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
580+
Setting<TimeValue> deprecatedSetting = LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING;
581+
String url = "https://ela.st/es-deprecation-8-lifecycle-master-timeout-setting";
582+
return checkRemovedSetting(
583+
settings,
584+
deprecatedSetting,
585+
url,
586+
"As of 7.16 the timeout is always infinite.",
587+
DeprecationIssue.Level.WARNING
588+
);
589+
}
590+
591+
static DeprecationIssue checkEqlEnabledSetting(final Settings settings, final PluginsAndModules pluginsAndModules) {
592+
Setting<Boolean> deprecatedSetting = Setting.boolSetting(
593+
"xpack.eql.enabled",
594+
true,
595+
Setting.Property.NodeScope,
596+
Setting.Property.DeprecatedWarning
597+
);
598+
String url = "https://ela.st/es-deprecation-8-eql-enabled-setting";
599+
return checkRemovedSetting(
600+
settings,
601+
deprecatedSetting,
602+
url,
603+
"As of 7.9.2 basic license level features are always enabled.",
604+
DeprecationIssue.Level.WARNING
605+
);
606+
}
607+
568608
}

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
package org.elasticsearch.xpack.deprecation;
99

10+
import org.apache.logging.log4j.Level;
11+
import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules;
1012
import org.elasticsearch.cluster.routing.allocation.DataTier;
1113
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
1214
import org.elasticsearch.common.Strings;
@@ -18,8 +20,10 @@
1820
import org.elasticsearch.script.ScriptService;
1921
import org.elasticsearch.test.ESTestCase;
2022
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
23+
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
2124

2225
import java.util.ArrayList;
26+
import java.util.Collections;
2327
import java.util.List;
2428
import java.util.stream.Collectors;
2529

@@ -53,11 +57,8 @@ public void testRemovedSetting() {
5357
);
5458
assertThat(issue, not(nullValue()));
5559
assertThat(issue.getLevel(), equalTo(DeprecationIssue.Level.CRITICAL));
56-
assertThat(
57-
issue.getMessage(),
58-
equalTo("setting [node.removed_setting] is deprecated and will be removed in the next major version")
59-
);
60-
assertThat(issue.getDetails(), equalTo("the setting [node.removed_setting] is currently set to [value], remove this setting"));
60+
assertThat(issue.getMessage(), equalTo("Setting [node.removed_setting] is deprecated"));
61+
assertThat(issue.getDetails(), equalTo("Remove the [node.removed_setting] setting."));
6162
assertThat(issue.getUrl(), equalTo("https://removed-setting.example.com"));
6263
}
6364

@@ -591,4 +592,60 @@ public void testEnforceDefaultTierPreferenceSetting() {
591592
);
592593
}
593594

595+
private List<DeprecationIssue> getDeprecationIssues(Settings settings, PluginsAndModules pluginsAndModules) {
596+
final List<DeprecationIssue> issues = DeprecationChecks.filterChecks(
597+
DeprecationChecks.NODE_SETTINGS_CHECKS,
598+
c -> c.apply(settings, pluginsAndModules)
599+
);
600+
601+
return issues;
602+
}
603+
604+
public void testLifecyleStepMasterTimeoutSetting() {
605+
Settings settings = Settings.builder()
606+
.put(LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING.getKey(), randomTimeValue())
607+
.build();
608+
final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList());
609+
final List<DeprecationIssue> issues = getDeprecationIssues(settings, pluginsAndModules);
610+
final DeprecationIssue expected = new DeprecationIssue(
611+
DeprecationIssue.Level.WARNING,
612+
"Setting [indices.lifecycle.step.master_timeout] is deprecated",
613+
"https://ela.st/es-deprecation-8-lifecycle-master-timeout-setting",
614+
"Remove the [indices.lifecycle.step.master_timeout] setting. As of 7.16 the timeout is always infinite.",
615+
false,
616+
null
617+
);
618+
assertThat(issues, hasItem(expected));
619+
assertWarnings(
620+
true,
621+
new DeprecationWarning(
622+
Level.WARN,
623+
"[indices.lifecycle.step.master_timeout] setting was deprecated in Elasticsearch and will be removed in a future release!"
624+
+ " See the breaking changes documentation for the next major version."
625+
)
626+
);
627+
}
628+
629+
public void testEqlEnabledSetting() {
630+
Settings settings = Settings.builder().put("xpack.eql.enabled", randomBoolean()).build();
631+
final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList());
632+
final List<DeprecationIssue> issues = getDeprecationIssues(settings, pluginsAndModules);
633+
final DeprecationIssue expected = new DeprecationIssue(
634+
DeprecationIssue.Level.WARNING,
635+
"Setting [xpack.eql.enabled] is deprecated",
636+
"https://ela.st/es-deprecation-8-eql-enabled-setting",
637+
"Remove the [xpack.eql.enabled] setting. As of 7.9.2 basic license level features are always enabled.",
638+
false,
639+
null
640+
);
641+
assertThat(issues, hasItem(expected));
642+
assertWarnings(
643+
true,
644+
new DeprecationWarning(
645+
Level.WARN,
646+
"[xpack.eql.enabled] setting was deprecated in Elasticsearch and will be removed in a future release!"
647+
+ " See the breaking changes documentation for the next major version."
648+
)
649+
);
650+
}
594651
}

0 commit comments

Comments
 (0)