Skip to content

Commit dfb6def

Browse files
Revert "Restore xpack.ilm.enabled and xpack.slm.enabled settings (#57383)"
This reverts commit 7a67fb2.
1 parent de27253 commit dfb6def

File tree

17 files changed

+149
-292
lines changed

17 files changed

+149
-292
lines changed

docs/reference/migration/migrate_7_8.asciidoc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,30 +94,26 @@ setting.
9494

9595
[[deprecate-basic-license-feature-enabled]]
9696

97-
.Several {xpack} settings no longer have any effect and are deprecated.
97+
.Several {xpack} settings no longer have any effect and are deprecated.
9898

9999
[%collapsible]
100100
====
101101
*Details* +
102-
Basic {xpack} license features are always enabled for the {default-dist}
103-
and the following settings no longer have any effect:
102+
Basic {xpack} license features are always enabled for the {default-dist}
103+
and the following settings no longer have any effect:
104104
105105
* `xpack.enrich.enabled`
106106
* `xpack.flattened.enabled`
107+
* `xpack.ilm.enabled`
107108
* `xpack.monitoring.enabled`
108109
* `xpack.rollup.enabled`
110+
* `xpack.slm.enabled`
109111
* `xpack.sql.enabled`
110112
* `xpack.transform.enabled`
111113
* `xpack.vectors.enabled`
112114
113115
Previously, they could be set to `false` to disable the feature's APIs in a cluster.
114116
115-
The ILM and SLM settings have been deprecated, but still have the effect of disabling
116-
their respective APIs:
117-
118-
* `xpack.ilm.enabled`
119-
* `xpack.slm.enabled`
120-
121117
*Impact* +
122118
To avoid deprecation warnings, discontinue use of these settings.
123119
If you have disabled ILM so that you can use another tool to manage Watcher

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,17 @@ private XPackSettings() {
118118

119119
/**
120120
* Setting for enabling or disabling the index lifecycle extension. Defaults to true.
121+
* <p>
122+
* This setting is now a no-op: setting it to false is permitted, but does nothing.
121123
*/
122124
@Deprecated // since 7.8.0
123125
public static final Setting<Boolean> INDEX_LIFECYCLE_ENABLED = Setting.boolSetting("xpack.ilm.enabled", true,
124126
Property.NodeScope, Property.Deprecated);
125127

126128
/**
127129
* Setting for enabling or disabling the snapshot lifecycle extension. Defaults to true.
130+
* <p>
131+
* This setting is now a no-op: setting it to false is permitted, but does nothing.
128132
*/
129133
@Deprecated // since = "7.8.0"
130134
public static final Setting<Boolean> SNAPSHOT_LIFECYCLE_ENABLED = Setting.boolSetting("xpack.slm.enabled", true,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ public void writeTo(StreamOutput out) throws IOException {
4949
}
5050
}
5151

52-
public IndexLifecycleFeatureSetUsage(boolean available, boolean enabled) {
53-
this(available, enabled, null);
52+
public IndexLifecycleFeatureSetUsage(boolean available) {
53+
this(available, null);
5454
}
5555

56-
public IndexLifecycleFeatureSetUsage(boolean available, boolean enabled, List<PolicyStats> policyStats) {
57-
super(XPackField.INDEX_LIFECYCLE, available, enabled);
56+
public IndexLifecycleFeatureSetUsage(boolean available, List<PolicyStats> policyStats) {
57+
super(XPackField.INDEX_LIFECYCLE, available, true);
5858
this.policyStats = policyStats;
5959
}
6060

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SLMFeatureSetUsage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public void writeTo(StreamOutput out) throws IOException {
3333
out.writeOptionalWriteable(this.slmStats);
3434
}
3535

36-
public SLMFeatureSetUsage(boolean available, boolean enabled, @Nullable SnapshotLifecycleStats slmStats) {
37-
super(XPackField.SNAPSHOT_LIFECYCLE, available, enabled);
36+
public SLMFeatureSetUsage(boolean available, @Nullable SnapshotLifecycleStats slmStats) {
37+
super(XPackField.SNAPSHOT_LIFECYCLE, available, true);
3838
this.slmStats = slmStats;
3939
}
4040

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/template/IndexTemplateRegistry.java

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.elasticsearch.gateway.GatewayService;
2727
import org.elasticsearch.threadpool.ThreadPool;
2828
import org.elasticsearch.xpack.core.XPackClient;
29-
import org.elasticsearch.xpack.core.XPackSettings;
3029
import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata;
3130
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
3231
import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction;
@@ -203,29 +202,26 @@ public void onFailure(Exception e) {
203202
}
204203

205204
private void addIndexLifecyclePoliciesIfMissing(ClusterState state) {
206-
boolean ilmSupported = XPackSettings.INDEX_LIFECYCLE_ENABLED.get(settings);
207205

208-
if (ilmSupported) {
209-
Optional<IndexLifecycleMetadata> maybeMeta = Optional.ofNullable(state.metadata().custom(IndexLifecycleMetadata.TYPE));
210-
List<LifecyclePolicy> policies = getPolicyConfigs().stream()
211-
.map(policyConfig -> policyConfig.load(xContentRegistry))
212-
.collect(Collectors.toList());
206+
Optional<IndexLifecycleMetadata> maybeMeta = Optional.ofNullable(state.metadata().custom(IndexLifecycleMetadata.TYPE));
207+
List<LifecyclePolicy> policies = getPolicyConfigs().stream()
208+
.map(policyConfig -> policyConfig.load(xContentRegistry))
209+
.collect(Collectors.toList());
213210

214-
for (LifecyclePolicy policy : policies) {
215-
final AtomicBoolean creationCheck = policyCreationsInProgress.computeIfAbsent(policy.getName(),
216-
key -> new AtomicBoolean(false));
217-
if (creationCheck.compareAndSet(false, true)) {
218-
final boolean policyNeedsToBeCreated = maybeMeta
219-
.flatMap(ilmMeta -> Optional.ofNullable(ilmMeta.getPolicies().get(policy.getName())))
220-
.isPresent() == false;
221-
if (policyNeedsToBeCreated) {
222-
logger.debug("adding lifecycle policy [{}] for [{}], because it doesn't exist", policy.getName(), getOrigin());
223-
putPolicy(policy, creationCheck);
224-
} else {
225-
logger.trace("not adding lifecycle policy [{}] for [{}], because it already exists",
226-
policy.getName(), getOrigin());
227-
creationCheck.set(false);
228-
}
211+
for (LifecyclePolicy policy : policies) {
212+
final AtomicBoolean creationCheck = policyCreationsInProgress.computeIfAbsent(policy.getName(),
213+
key -> new AtomicBoolean(false));
214+
if (creationCheck.compareAndSet(false, true)) {
215+
final boolean policyNeedsToBeCreated = maybeMeta
216+
.flatMap(ilmMeta -> Optional.ofNullable(ilmMeta.getPolicies().get(policy.getName())))
217+
.isPresent() == false;
218+
if (policyNeedsToBeCreated) {
219+
logger.debug("adding lifecycle policy [{}] for [{}], because it doesn't exist", policy.getName(), getOrigin());
220+
putPolicy(policy, creationCheck);
221+
} else {
222+
logger.trace("not adding lifecycle policy [{}] for [{}], because it already exists",
223+
policy.getName(), getOrigin());
224+
creationCheck.set(false);
229225
}
230226
}
231227
}

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/anomalydetection/state_index_template.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"index" : {
99
"auto_expand_replicas" : "0-1",
1010
"hidden": true
11-
}
12-
${xpack.ml.index.lifecycle.settings}
11+
},
12+
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
13+
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
1314
},
1415
"mappings" : {
1516
"_doc": {

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/stats_index_template.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
"number_of_shards" : "1",
1010
"auto_expand_replicas" : "0-1",
1111
"hidden": true
12-
}
13-
${xpack.ml.index.lifecycle.settings}
12+
},
13+
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
14+
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
1415
},
1516
"mappings" : ${xpack.ml.stats.mappings},
1617
"aliases" : {}

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsageTests.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,18 @@ protected IndexLifecycleFeatureSetUsage createTestInstance() {
2828
policyStats.add(PolicyStatsTests.createRandomInstance());
2929
}
3030
}
31-
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
31+
return new IndexLifecycleFeatureSetUsage(available, policyStats);
3232
}
3333

3434
@Override
3535
protected IndexLifecycleFeatureSetUsage mutateInstance(IndexLifecycleFeatureSetUsage instance) throws IOException {
3636
boolean available = instance.available();
37-
boolean enabled = instance.enabled();
3837
List<PolicyStats> policyStats = instance.getPolicyStats();
39-
switch (between(0, 2)) {
38+
switch (between(0, 1)) {
4039
case 0:
4140
available = available == false;
4241
break;
4342
case 1:
44-
enabled = enabled == false;
45-
break;
46-
case 2:
4743
if (policyStats == null) {
4844
policyStats = new ArrayList<>();
4945
policyStats.add(PolicyStatsTests.createRandomInstance());
@@ -57,7 +53,7 @@ protected IndexLifecycleFeatureSetUsage mutateInstance(IndexLifecycleFeatureSetU
5753
default:
5854
throw new AssertionError("Illegal randomisation branch");
5955
}
60-
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
56+
return new IndexLifecycleFeatureSetUsage(available, policyStats);
6157
}
6258

6359
@Override

0 commit comments

Comments
 (0)