Skip to content

Commit

Permalink
Add xpack setting deprecations to deprecation API (#56290)
Browse files Browse the repository at this point in the history
* Add xpack setting deprecations to deprecation API

The deprecated settings showed up in the deprecation log file by
default, but I did not add them to the deprecation API. This commit
fixes that. Now if you use one of the deprecated basic feature
enablement settings, calling _monitoring/deprecations will inform you of
that fact.

* Remove incorrectly backported settings documents

It seems that I backported these docs to the wrong place in #56061,
in #55980, and in #56167. I hope they're in the right place now.

Co-authored-by: debadair <[email protected]>
  • Loading branch information
williamrandolph and debadair authored May 7, 2020
1 parent b5e385f commit 691044e
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 26 deletions.
25 changes: 0 additions & 25 deletions docs/reference/migration/migrate_7_0/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -288,28 +288,3 @@ still be adjusted as desired using the cluster settings API.
==== HTTP Max content length setting is no longer parsed leniently
Previously, `http.max_content_length` would reset to `100mb` if the setting was
greater than `Integer.MAX_VALUE`. This leniency has been removed.

[float]
==== Option to disable basic license features is deprecated

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

* `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, these settings could be set to `false` in order to disable the
feature's APIs in a cluster. As of 7.8.0, these basic license features are
always enabled for the {default-dist}.

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.

29 changes: 29 additions & 0 deletions docs/reference/migration/migrate_7_8.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,35 @@ To avoid deprecation warnings, discontinue use of the `node.local_storage`
setting.
====

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

.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:
* `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.
*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
indices, the newly introduced `xpack.watcher.use_ilm_index_management` setting
may be set to false.
====

[float]
[[builtin-users-changes]]
==== Changes to built-in users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig;
Expand Down Expand Up @@ -49,7 +50,25 @@ private DeprecationChecks() {
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerQueueSize(settings),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerSize(settings),
NodeDeprecationChecks::checkClusterRemoteConnectSetting,
NodeDeprecationChecks::checkNodeLocalStorageSetting
NodeDeprecationChecks::checkNodeLocalStorageSetting,
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.ENRICH_ENABLED_SETTING),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.FLATTENED_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.INDEX_LIFECYCLE_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.MONITORING_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.ROLLUP_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.SNAPSHOT_LIFECYCLE_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.SQL_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.TRANSFORM_ENABLED),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkNodeBasicLicenseFeatureEnabledSetting(settings,
XPackSettings.VECTORS_ENABLED)
));

static List<Function<IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static DeprecationIssue checkNodeLocalStorageSetting(final Settings setti
);
}

public static DeprecationIssue checkNodeBasicLicenseFeatureEnabledSetting(final Settings settings, Setting<?> setting) {
return checkRemovedSetting(
settings,
setting,
"https://www.elastic.co/guide/en/elasticsearch/reference/7.8/breaking-changes-7.8.html#deprecate-basic-license-feature-enabled"
);
}

private static DeprecationIssue checkDeprecatedSetting(
final Settings settings,
final PluginsAndModules pluginsAndModules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
package org.elasticsearch.xpack.deprecation;

import org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules;
import org.elasticsearch.common.collect.Set;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.env.Environment;
import org.elasticsearch.node.Node;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.transport.RemoteClusterService;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
import org.elasticsearch.xpack.core.security.authc.RealmSettings;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -215,6 +218,37 @@ public void testNodeLocalStorageSetting() {
assertSettingDeprecationsAndWarnings(new Setting<?>[]{Node.NODE_LOCAL_STORAGE_SETTING});
}

public void testDeprecatedBasicLicenseSettings() {
Collection<Setting<Boolean>> deprecatedXpackSettings = Set.of(
XPackSettings.ENRICH_ENABLED_SETTING,
XPackSettings.FLATTENED_ENABLED,
XPackSettings.INDEX_LIFECYCLE_ENABLED,
XPackSettings.MONITORING_ENABLED,
XPackSettings.ROLLUP_ENABLED,
XPackSettings.SNAPSHOT_LIFECYCLE_ENABLED,
XPackSettings.SQL_ENABLED,
XPackSettings.TRANSFORM_ENABLED,
XPackSettings.VECTORS_ENABLED
);

for (Setting<Boolean> deprecatedSetting : deprecatedXpackSettings) {
final boolean value = randomBoolean();
final Settings settings = Settings.builder().put(deprecatedSetting.getKey(), value).build();
final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList());
final List<DeprecationIssue> issues =
DeprecationChecks.filterChecks(DeprecationChecks.NODE_SETTINGS_CHECKS, c -> c.apply(settings, pluginsAndModules));
final DeprecationIssue expected = new DeprecationIssue(
DeprecationIssue.Level.CRITICAL,
"setting [" + deprecatedSetting.getKey() + "] is deprecated and will be removed in the next major version",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.8/breaking-changes-7.8.html" +
"#deprecate-basic-license-feature-enabled",
"the setting [" + deprecatedSetting.getKey() + "] is currently set to [" + value + "], remove this setting"
);
assertThat(issues, contains(expected));
assertSettingDeprecationsAndWarnings(new Setting<?>[]{deprecatedSetting});
}
}

public void testRemovedSettingNotSet() {
final Settings settings = Settings.EMPTY;
final Setting<?> removedSetting = Setting.simpleString("node.removed_setting");
Expand Down

0 comments on commit 691044e

Please sign in to comment.