Skip to content
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
17 changes: 14 additions & 3 deletions docs/reference/migration/migrate_8_0/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@ removed.
[float]
==== Option to disable basic license features is deprecated

In Elasticsearch 7.8.0, the following settings have been deprecated:
In Elasticsearch 7.8.0, the following settings no longer have any effect, and
have been deprecated:

* `xpack.ilm.enabled`

In other words, even if `xpack.ilm.enabled` is set to `false`, the ILM APIs
will be available.

If you have disabled ILM so that you can use another tool to manage Watcher
indices, the newly introduced `xpack.watcher.use_ilm_index_management` setting
may be set to false.

Additionally, the following settings have been deprecated:

* `xpack.enrich.enabled`
* `xpack.flattened.enabled`
* `xpack.ilm.enabled`
* `xpack.monitoring.enabled`
* `xpack.rollup.enabled`
* `xpack.slm.enabled`
Expand All @@ -82,7 +93,7 @@ In Elasticsearch 7.8.0, the following settings have been deprecated:
* `xpack.vectors.enabled`

In future releases, it will not be possible to disable the APIs for Enrichment,
Flattened mappings, ILM, Monitoring, Rollup, SLM, SQL, Transforms, and Vectors.
Flattened mappings, Monitoring, Rollup, SLM, SQL, Transforms, and Vectors.

[float]
==== The `prefer_v2_templates` parameter now defaults to `true`
Expand Down
5 changes: 2 additions & 3 deletions docs/reference/settings/ilm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ These are the settings available for configuring Index Lifecycle Management
==== Cluster level settings

`xpack.ilm.enabled`::
deprecated:[7.8.0,Basic License features should always be enabled] +
Whether ILM is enabled or disabled, setting this to `false` disables any ILM
REST API endpoints and functionality. Defaults to `true`.
deprecated:[7.8.0,Basic License features are always enabled] +
This deprecated setting has no effect and will be removed in Elasticsearch 8.0.

`indices.lifecycle.poll_interval`::
(<<time-units, time units>>) How often {ilm} checks for indices that meet policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ 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);

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, boolean enabled) {
this(available, enabled, null);
public IndexLifecycleFeatureSetUsage(boolean available) {
this(available, null);
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.threadpool.ThreadPool;
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 @@ -200,29 +199,26 @@ public void onFailure(Exception e) {
}

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

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());
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,8 +8,9 @@
"index" : {
"auto_expand_replicas" : "0-1",
"hidden": true
}
${xpack.ml.index.lifecycle.settings}
},
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
},
"mappings" : {
"_doc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"number_of_shards" : "1",
"auto_expand_replicas" : "0-1",
"hidden": true
}
${xpack.ml.index.lifecycle.settings}
},
"index.lifecycle.name": "${xpack.ml.index.lifecycle.name}",
"index.lifecycle.rollover_alias": "${xpack.ml.index.lifecycle.rollover_alias}"
},
"mappings" : ${xpack.ml.stats.mappings},
"aliases" : {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,18 @@ protected IndexLifecycleFeatureSetUsage createTestInstance() {
policyStats.add(PolicyStatsTests.createRandomInstance());
}
}
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
return new IndexLifecycleFeatureSetUsage(available, 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, 2)) {
switch (between(0, 1)) {
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 @@ -57,7 +53,7 @@ protected IndexLifecycleFeatureSetUsage mutateInstance(IndexLifecycleFeatureSetU
default:
throw new AssertionError("Illegal randomisation branch");
}
return new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
return new IndexLifecycleFeatureSetUsage(available, policyStats);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,10 @@ public class IndexLifecycle extends Plugin implements ActionPlugin {
private final SetOnce<SnapshotRetentionService> snapshotRetentionService = new SetOnce<>();
private final SetOnce<SnapshotHistoryStore> snapshotHistoryStore = new SetOnce<>();
private Settings settings;
private boolean ilmEnabled;
private boolean slmEnabled;

public IndexLifecycle(Settings settings) {
this.settings = settings;
this.ilmEnabled = XPackSettings.INDEX_LIFECYCLE_ENABLED.get(settings);
this.slmEnabled = XPackSettings.SNAPSHOT_LIFECYCLE_ENABLED.get(settings);
}

Expand Down Expand Up @@ -180,17 +178,15 @@ public Collection<Object> createComponents(Client client, ClusterService cluster
IndexNameExpressionResolver expressionResolver,
Supplier<RepositoriesService> repositoriesServiceSupplier) {
final List<Object> components = new ArrayList<>();
if (ilmEnabled) {
// This registers a cluster state listener, so appears unused but is not.
@SuppressWarnings("unused")
ILMHistoryTemplateRegistry ilmTemplateRegistry =
new ILMHistoryTemplateRegistry(settings, clusterService, threadPool, client, xContentRegistry);
ilmHistoryStore.set(new ILMHistoryStore(settings, new OriginSettingClient(client, INDEX_LIFECYCLE_ORIGIN),
clusterService, threadPool));
indexLifecycleInitialisationService.set(new IndexLifecycleService(settings, client, clusterService, threadPool,
getClock(), System::currentTimeMillis, xContentRegistry, ilmHistoryStore.get()));
components.add(indexLifecycleInitialisationService.get());
}
// This registers a cluster state listener, so appears unused but is not.
@SuppressWarnings("unused")
ILMHistoryTemplateRegistry ilmTemplateRegistry =
new ILMHistoryTemplateRegistry(settings, clusterService, threadPool, client, xContentRegistry);
ilmHistoryStore.set(new ILMHistoryStore(settings, new OriginSettingClient(client, INDEX_LIFECYCLE_ORIGIN),
clusterService, threadPool));
indexLifecycleInitialisationService.set(new IndexLifecycleService(settings, client, clusterService, threadPool,
getClock(), System::currentTimeMillis, xContentRegistry, ilmHistoryStore.get()));
components.add(indexLifecycleInitialisationService.get());
if (slmEnabled) {
// the template registry is a cluster state listener
@SuppressWarnings("unused")
Expand Down Expand Up @@ -246,20 +242,19 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster) {
List<RestHandler> handlers = new ArrayList<>();
if (ilmEnabled) {
handlers.addAll(Arrays.asList(
new RestPutLifecycleAction(),
new RestGetLifecycleAction(),
new RestDeleteLifecycleAction(),
new RestExplainLifecycleAction(),
new RestRemoveIndexLifecyclePolicyAction(),
new RestMoveToStepAction(),
new RestRetryAction(),
new RestStopAction(),
new RestStartILMAction(),
new RestGetStatusAction()
));
}
// add ILM rest handlers
handlers.addAll(Arrays.asList(
new RestPutLifecycleAction(),
new RestGetLifecycleAction(),
new RestDeleteLifecycleAction(),
new RestExplainLifecycleAction(),
new RestRemoveIndexLifecyclePolicyAction(),
new RestMoveToStepAction(),
new RestRetryAction(),
new RestStopAction(),
new RestStartILMAction(),
new RestGetStatusAction()
));
if (slmEnabled) {
handlers.addAll(Arrays.asList(
new RestPutSnapshotLifecycleAction(),
Expand Down Expand Up @@ -287,20 +282,19 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
actions.add(ilmInfoAction);
actions.add(slmUsageAction);
actions.add(slmInfoAction);
if (ilmEnabled) {
actions.addAll(Arrays.asList(
new ActionHandler<>(PutLifecycleAction.INSTANCE, TransportPutLifecycleAction.class),
new ActionHandler<>(GetLifecycleAction.INSTANCE, TransportGetLifecycleAction.class),
new ActionHandler<>(DeleteLifecycleAction.INSTANCE, TransportDeleteLifecycleAction.class),
new ActionHandler<>(ExplainLifecycleAction.INSTANCE, TransportExplainLifecycleAction.class),
new ActionHandler<>(RemoveIndexLifecyclePolicyAction.INSTANCE, TransportRemoveIndexLifecyclePolicyAction.class),
new ActionHandler<>(MoveToStepAction.INSTANCE, TransportMoveToStepAction.class),
new ActionHandler<>(RetryAction.INSTANCE, TransportRetryAction.class),
new ActionHandler<>(StartILMAction.INSTANCE, TransportStartILMAction.class),
new ActionHandler<>(StopILMAction.INSTANCE, TransportStopILMAction.class),
new ActionHandler<>(GetStatusAction.INSTANCE, TransportGetStatusAction.class)
));
}
// add ILM actions
actions.addAll(Arrays.asList(
new ActionHandler<>(PutLifecycleAction.INSTANCE, TransportPutLifecycleAction.class),
new ActionHandler<>(GetLifecycleAction.INSTANCE, TransportGetLifecycleAction.class),
new ActionHandler<>(DeleteLifecycleAction.INSTANCE, TransportDeleteLifecycleAction.class),
new ActionHandler<>(ExplainLifecycleAction.INSTANCE, TransportExplainLifecycleAction.class),
new ActionHandler<>(RemoveIndexLifecyclePolicyAction.INSTANCE, TransportRemoveIndexLifecyclePolicyAction.class),
new ActionHandler<>(MoveToStepAction.INSTANCE, TransportMoveToStepAction.class),
new ActionHandler<>(RetryAction.INSTANCE, TransportRetryAction.class),
new ActionHandler<>(StartILMAction.INSTANCE, TransportStartILMAction.class),
new ActionHandler<>(StopILMAction.INSTANCE, TransportStopILMAction.class),
new ActionHandler<>(GetStatusAction.INSTANCE, TransportGetStatusAction.class)
));
if (slmEnabled) {
actions.addAll(Arrays.asList(
new ActionHandler<>(PutSnapshotLifecycleAction.INSTANCE, TransportPutSnapshotLifecycleAction.class),
Expand All @@ -319,10 +313,8 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC

@Override
public void onIndexModule(IndexModule indexModule) {
if (ilmEnabled) {
assert indexLifecycleInitialisationService.get() != null;
indexModule.addIndexEventListener(indexLifecycleInitialisationService.get());
}
assert indexLifecycleInitialisationService.get() != null;
indexModule.addIndexEventListener(indexLifecycleInitialisationService.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@

import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.XPackField;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
import org.elasticsearch.xpack.core.action.XPackInfoFeatureTransportAction;

public class IndexLifecycleInfoTransportAction extends XPackInfoFeatureTransportAction {

private final boolean enabled;
private final XPackLicenseState licenseState;

@Inject
public IndexLifecycleInfoTransportAction(TransportService transportService, ActionFilters actionFilters,
Settings settings, XPackLicenseState licenseState) {
XPackLicenseState licenseState) {
super(XPackInfoFeatureAction.INDEX_LIFECYCLE.name(), transportService, actionFilters);
this.enabled = XPackSettings.INDEX_LIFECYCLE_ENABLED.get(settings);
this.licenseState = licenseState;
}

Expand All @@ -40,7 +36,7 @@ public boolean available() {

@Override
public boolean enabled() {
return enabled;
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction;
Expand All @@ -33,7 +32,6 @@
import java.util.stream.Collectors;

public class IndexLifecycleUsageTransportAction extends XPackUsageFeatureTransportAction {
private final boolean enabled;
private final XPackLicenseState licenseState;

@Inject
Expand All @@ -42,7 +40,6 @@ public IndexLifecycleUsageTransportAction(TransportService transportService, Clu
Settings settings, XPackLicenseState licenseState) {
super(XPackUsageFeatureAction.INDEX_LIFECYCLE.name(), transportService, clusterService, threadPool, actionFilters,
indexNameExpressionResolver);
this.enabled = XPackSettings.INDEX_LIFECYCLE_ENABLED.get(settings);
this.licenseState = licenseState;
}

Expand All @@ -53,7 +50,7 @@ protected void masterOperation(Task task, XPackUsageRequest request, ClusterStat
Metadata metadata = state.metadata();
IndexLifecycleMetadata lifecycleMetadata = metadata.custom(IndexLifecycleMetadata.TYPE);
final IndexLifecycleFeatureSetUsage usage;
if (enabled && lifecycleMetadata != null) {
if (lifecycleMetadata != null) {
Map<String, Integer> policyUsage = new HashMap<>();
metadata.indices().forEach(entry -> {
String policyName = LifecycleSettings.LIFECYCLE_NAME_SETTING.get(entry.value.getSettings());
Expand All @@ -72,9 +69,9 @@ protected void masterOperation(Task task, XPackUsageRequest request, ClusterStat
}).collect(Collectors.toMap(Tuple::v1, Tuple::v2));
return new IndexLifecycleFeatureSetUsage.PolicyStats(phaseStats, policyUsage.getOrDefault(policy.getName(), 0));
}).collect(Collectors.toList());
usage = new IndexLifecycleFeatureSetUsage(available, enabled, policyStats);
usage = new IndexLifecycleFeatureSetUsage(available, policyStats);
} else {
usage = new IndexLifecycleFeatureSetUsage(available, enabled);
usage = new IndexLifecycleFeatureSetUsage(available);
}
listener.onResponse(new XPackUsageFeatureResponse(usage));
}
Expand Down
Loading