Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore xpack.ilm.enabled and xpack.slm.enabled settings #57383

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/reference/migration/migrate_7_8.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,30 @@ setting.

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

.Several {xpack} settings no longer have any effect and are deprecated.
.Several {xpack} settings no longer have any effect and are deprecated.

[%collapsible]
====
*Details* +
Basic {xpack} license features are always enabled for the {default-dist}
and the following settings no longer have any effect:
Basic {xpack} license features are always enabled for the {default-dist}
and the following settings no longer have any effect:

* `xpack.enrich.enabled`
* `xpack.flattened.enabled`
* `xpack.ilm.enabled`
* `xpack.monitoring.enabled`
* `xpack.rollup.enabled`
* `xpack.slm.enabled`
* `xpack.sql.enabled`
* `xpack.transform.enabled`
* `xpack.vectors.enabled`

Previously, they could be set to `false` to disable the feature's APIs in a cluster.

The ILM and SLM settings have been deprecated, but still have the effect of disabling
their respective APIs:

* `xpack.ilm.enabled`
* `xpack.slm.enabled`

*Impact* +
To avoid deprecation warnings, discontinue use of these settings.
If you have disabled ILM so that you can use another tool to manage Watcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,13 @@ private XPackSettings() {

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

/**
* Setting for enabling or disabling the snapshot lifecycle extension. Defaults to true.
* <p>
* This setting is now a no-op: setting it to false is permitted, but does nothing.
*/
@Deprecated // since = "7.8.0"
public static final Setting<Boolean> SNAPSHOT_LIFECYCLE_ENABLED = Setting.boolSetting("xpack.slm.enabled", true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public void writeTo(StreamOutput out) throws IOException {
}
}

public IndexLifecycleFeatureSetUsage(boolean available) {
this(available, null);
public IndexLifecycleFeatureSetUsage(boolean available, boolean enabled) {
this(available, enabled, null);
}

public IndexLifecycleFeatureSetUsage(boolean available, List<PolicyStats> policyStats) {
super(XPackField.INDEX_LIFECYCLE, available, true);
public IndexLifecycleFeatureSetUsage(boolean available, boolean enabled, List<PolicyStats> policyStats) {
super(XPackField.INDEX_LIFECYCLE, available, enabled);
this.policyStats = policyStats;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalWriteable(this.slmStats);
}

public SLMFeatureSetUsage(boolean available, @Nullable SnapshotLifecycleStats slmStats) {
super(XPackField.SNAPSHOT_LIFECYCLE, available, true);
public SLMFeatureSetUsage(boolean available, boolean enabled, @Nullable SnapshotLifecycleStats slmStats) {
super(XPackField.SNAPSHOT_LIFECYCLE, available, enabled);
this.slmStats = slmStats;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.XPackClient;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata;
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction;
Expand Down Expand Up @@ -202,26 +203,29 @@ public void onFailure(Exception e) {
}

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

Optional<IndexLifecycleMetadata> maybeMeta = Optional.ofNullable(state.metadata().custom(IndexLifecycleMetadata.TYPE));
List<LifecyclePolicy> policies = getPolicyConfigs().stream()
.map(policyConfig -> policyConfig.load(xContentRegistry))
.collect(Collectors.toList());
if (ilmSupported) {
Optional<IndexLifecycleMetadata> maybeMeta = Optional.ofNullable(state.metadata().custom(IndexLifecycleMetadata.TYPE));
List<LifecyclePolicy> policies = getPolicyConfigs().stream()
.map(policyConfig -> policyConfig.load(xContentRegistry))
.collect(Collectors.toList());

for (LifecyclePolicy policy : policies) {
final AtomicBoolean creationCheck = policyCreationsInProgress.computeIfAbsent(policy.getName(),
key -> new AtomicBoolean(false));
if (creationCheck.compareAndSet(false, true)) {
final boolean policyNeedsToBeCreated = maybeMeta
.flatMap(ilmMeta -> Optional.ofNullable(ilmMeta.getPolicies().get(policy.getName())))
.isPresent() == false;
if (policyNeedsToBeCreated) {
logger.debug("adding lifecycle policy [{}] for [{}], because it doesn't exist", policy.getName(), getOrigin());
putPolicy(policy, creationCheck);
} else {
logger.trace("not adding lifecycle policy [{}] for [{}], because it already exists",
policy.getName(), getOrigin());
creationCheck.set(false);
for (LifecyclePolicy policy : policies) {
final AtomicBoolean creationCheck = policyCreationsInProgress.computeIfAbsent(policy.getName(),
key -> new AtomicBoolean(false));
if (creationCheck.compareAndSet(false, true)) {
final boolean policyNeedsToBeCreated = maybeMeta
.flatMap(ilmMeta -> Optional.ofNullable(ilmMeta.getPolicies().get(policy.getName())))
.isPresent() == false;
if (policyNeedsToBeCreated) {
logger.debug("adding lifecycle policy [{}] for [{}], because it doesn't exist", policy.getName(), getOrigin());
putPolicy(policy, creationCheck);
} else {
logger.trace("not adding lifecycle policy [{}] for [{}], because it already exists",
policy.getName(), getOrigin());
creationCheck.set(false);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"index" : {
"auto_expand_replicas" : "0-1",
"hidden": true
},
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
}
${xpack.ml.index.lifecycle.settings}
},
"mappings" : {
"_doc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"number_of_shards" : "1",
"auto_expand_replicas" : "0-1",
"hidden": true
},
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
}
${xpack.ml.index.lifecycle.settings}
},
"mappings" : ${xpack.ml.stats.mappings},
"aliases" : {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,22 @@ protected IndexLifecycleFeatureSetUsage createTestInstance() {
policyStats.add(PolicyStatsTests.createRandomInstance());
}
}
return new IndexLifecycleFeatureSetUsage(available, policyStats);
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
}

@Override
protected IndexLifecycleFeatureSetUsage mutateInstance(IndexLifecycleFeatureSetUsage instance) throws IOException {
boolean available = instance.available();
boolean enabled = instance.enabled();
List<PolicyStats> policyStats = instance.getPolicyStats();
switch (between(0, 1)) {
switch (between(0, 2)) {
case 0:
available = available == false;
break;
case 1:
enabled = enabled == false;
break;
case 2:
if (policyStats == null) {
policyStats = new ArrayList<>();
policyStats.add(PolicyStatsTests.createRandomInstance());
Expand All @@ -53,7 +57,7 @@ protected IndexLifecycleFeatureSetUsage mutateInstance(IndexLifecycleFeatureSetU
default:
throw new AssertionError("Illegal randomisation branch");
}
return new IndexLifecycleFeatureSetUsage(available, policyStats);
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
}

@Override
Expand Down
Loading