Skip to content

Commit

Permalink
Deprecated xpack "enable" settings should be no-ops (#55416) (#56167)
Browse files Browse the repository at this point in the history
The following settings are now no-ops:

* xpack.flattened.enabled
* xpack.logstash.enabled
* xpack.rollup.enabled
* xpack.slm.enabled
* xpack.sql.enabled
* xpack.transform.enabled
* xpack.vectors.enabled

Since these settings no longer need to be checked, we can remove settings
parameters from a number of constructors and methods, and do so in this
commit.

We also update documentation to remove references to these settings.
  • Loading branch information
williamrandolph authored May 5, 2020
1 parent 94b349c commit 3499fa9
Show file tree
Hide file tree
Showing 49 changed files with 207 additions and 675 deletions.
19 changes: 7 additions & 12 deletions docs/reference/migration/migrate_7_0/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,15 @@ greater than `Integer.MAX_VALUE`. This leniency has been removed.
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
Expand All @@ -306,15 +313,3 @@ 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.rollup.enabled`
* `xpack.slm.enabled`
* `xpack.sql.enabled`
* `xpack.transform.enabled`
* `xpack.vectors.enabled`

In future releases, it will not be possible to disable the APIs for Enrichment,
Flattened mappings, Rollup, SLM, SQL, Transforms, and Vectors.
9 changes: 3 additions & 6 deletions docs/reference/modules/node.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,9 @@ node.remote_cluster_client: false <8>

{transform-cap} nodes run {transforms} and handle {transform} API requests.

If you want to use {transforms} in your cluster, you must not have
`xpack.transform.enabled` set to `false` on any master-eligible or data
nodes. To use {transforms} in clients (including {kib}), do not disable this
setting on any coordinating nodes. You must also have `node.transform` set to
`true` on at least one node. This is the default behavior. If you have the
{oss-dist}, do not use these settings. For more information, see
If you want to use {transforms} in your cluster, you must have `node.transform`
set to `true` on at least one node. This is the default behavior. If you have
the {oss-dist}, do not use these settings. For more information, see
<<transform-settings>>.

To create a dedicated {transform} node in the {default-dist}, set:
Expand Down
5 changes: 2 additions & 3 deletions docs/reference/settings/sql-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
<titleabbrev>SQL access settings</titleabbrev>
++++

SQL Access is enabled by default. You can configure
these SQL Access settings in the `elasticsearch.yml` file.
SQL Access is always enabled.

[float]
[[general-sql-settings]]
==== General SQL Access Settings
`xpack.sql.enabled`::
deprecated:[7.8.0,Basic License features should always be enabled] +
Set to `false` to disable SQL Access on the node.
This deprecated setting no longer has any effect.
32 changes: 9 additions & 23 deletions docs/reference/settings/transform-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,20 @@ file.
==== General {transforms} settings

`node.transform`::
Set to `true` to identify the node as a _transform node_. If either `node.data`
or `xpack.transform.enabled` is `false` for the node, the default value is
`false`. Otherwise, the default value is `true`.
Set to `true` to identify the node as a _transform node_. If `node.data`
is `false` for the node, the default value is `false`. Otherwise, the default
value is `true`.
+
If set to `false` in `elasticsearch.yml`, the node cannot run transforms. If set to
`true` but `xpack.transform.enabled` is set to `false`, the `node.transform` setting is
ignored and the node cannot run transforms. If you want to run transforms, there must be at
least one transform node in your cluster. +
If set to `false` in `elasticsearch.yml`, the node cannot run transforms. If
you want to run transforms, there must be at least one transform node in your
cluster. +
+
IMPORTANT: It is advised to use the `node.transform` setting to constrain the execution
of transforms to certain nodes instead of using `xpack.transform.enabled`. On dedicated
coordinating nodes or dedicated master nodes, disable the node.transform role.
IMPORTANT: On dedicated coordinating nodes or dedicated master nodes, disable
the node.transform role.

`xpack.transform.enabled`::
deprecated:[7.8.0,Basic License features should always be enabled] +
Set to `true` (default) to enable {transforms} on the node.
+
If set to `false` in `elasticsearch.yml`, the {transform} APIs are disabled on
the node. Therefore the node cannot start or administrate {transforms} or
receive transport (internal) communication requests related to {transform} APIs.
If the node is a coordinating node, {transform} requests from clients (including
{kib}) also fail.
+
IMPORTANT: If you want to use {transform} features in your cluster, it is
recommended that you set `xpack.transform.enabled` to `true` on all nodes. This
is the default behavior. At a minimum, it must be enabled on all master-eligible
nodes and all data nodes. If you want to use {transforms} in clients or {kib},
it must also be enabled on all coordinating nodes.
This deprecated setting no longer has any effect.

`xpack.transform.num_transform_failure_retries` (<<cluster-update-settings,Dynamic>>)::
The number of times that a {transform} retries when it experiences a
Expand Down
13 changes: 6 additions & 7 deletions docs/reference/transform/setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ To use the {transforms}, you must have the
==== {transform-cap} nodes

To use {transforms}, there must be at least one node in your cluster with
`xpack.transform.enabled` and `node.transform` set to `true`. By default, all
nodes are {transform} nodes unless you explicitly change these settings or set
`node.data` to `false`.
`node.transform` set to `true`. By default, all nodes are {transform} nodes
unless you explicitly change these settings or set `node.data` to `false`.

If you want to control which nodes run {transforms}, set `node.transform` to
`false` on some nodes.
Expand All @@ -35,14 +34,14 @@ which users can manage or view {transforms}.

To _view_ the configuration and status of {transforms}, you must have:

* `transform_user` built-in role or `monitor_transform`
* `transform_user` built-in role or `monitor_transform`
cluster privileges

To _manage_ {transforms}, you must have:

* `transform_admin` built-in role or `manage_transform`
* `transform_admin` built-in role or `manage_transform`
cluster privileges
* `read` and `view_index_metadata` index privileges on source indices
* `read`, `create_index`, and `index` index privileges on destination indices
For more information, see <<security-privileges>> and <<built-in-roles>>.

For more information, see <<security-privileges>> and <<built-in-roles>>.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ private XPackSettings() {

/**
* Setting for controlling whether or not enrich is enabled.
* <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> ENRICH_ENABLED_SETTING = Setting.boolSetting("xpack.enrich.enabled", true,
Property.NodeScope, Property.Deprecated);

Expand All @@ -55,7 +58,14 @@ private XPackSettings() {
@Deprecated // replaced by TRANSFORM_ENABLED
private static final Setting<Boolean> DATA_FRAME_ENABLED = Setting.boolSetting("xpack.data_frame.enabled", true,
Setting.Property.NodeScope, Setting.Property.Deprecated);
public static final Setting<Boolean> TRANSFORM_ENABLED = Setting.boolSetting("xpack.transform.enabled", DATA_FRAME_ENABLED,

/**
* Setting for enabling or disabling data frame. 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> TRANSFORM_ENABLED = Setting.boolSetting("xpack.transform.enabled", true,
Property.NodeScope, Property.Deprecated);

/** Setting for enabling or disabling security. Defaults to true. */
Expand All @@ -80,7 +90,12 @@ private XPackSettings() {
public static final Setting<Boolean> MACHINE_LEARNING_ENABLED = Setting.boolSetting("xpack.ml.enabled", true,
Setting.Property.NodeScope);

/** Setting for enabling or disabling rollup. Defaults to true. */
/**
* Setting for enabling or disabling rollup. 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> ROLLUP_ENABLED = Setting.boolSetting("xpack.rollup.enabled", true,
Property.NodeScope, Property.Deprecated);

Expand All @@ -92,7 +107,12 @@ private XPackSettings() {
public static final Setting<Boolean> DLS_FLS_ENABLED = Setting.boolSetting("xpack.security.dls_fls.enabled", true,
Setting.Property.NodeScope);

/** Setting for enabling or disabling Logstash extensions. Defaults to true. */
/**
* Setting for enabling or disabling Logstash extensions. 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> LOGSTASH_ENABLED = Setting.boolSetting("xpack.logstash.enabled", true,
Setting.Property.NodeScope, Property.Deprecated);

Expand All @@ -107,7 +127,10 @@ private XPackSettings() {

/**
* 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,
Property.NodeScope, Property.Deprecated);

Expand Down Expand Up @@ -135,15 +158,30 @@ private XPackSettings() {
public static final Setting<Boolean> FIPS_MODE_ENABLED =
Setting.boolSetting("xpack.security.fips_mode.enabled", false, Property.NodeScope);

/** Setting for enabling or disabling sql. Defaults to true. */
/**
* Setting for enabling or disabling sql. 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> SQL_ENABLED = Setting.boolSetting("xpack.sql.enabled", true,
Property.NodeScope, Property.Deprecated);

/** Setting for enabling or disabling flattened fields. Defaults to true. */
/**
* Setting for enabling or disabling flattened fields. 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> FLATTENED_ENABLED = Setting.boolSetting("xpack.flattened.enabled", true,
Property.NodeScope, Property.Deprecated);

/** Setting for enabling or disabling vectors. Defaults to true. */
/**
* Setting for enabling or disabling vectors. 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> VECTORS_ENABLED = Setting.boolSetting("xpack.vectors.enabled", true,
Property.NodeScope, Property.Deprecated);

Expand Down Expand Up @@ -284,6 +322,7 @@ public static List<Setting<?>> getAllSettings() {
settings.add(TRANSFORM_ENABLED);
settings.add(FLATTENED_ENABLED);
settings.add(VECTORS_ENABLED);
settings.add(ENRICH_ENABLED_SETTING);
settings.add(DIAGNOSE_TRUST_EXCEPTIONS_SETTING);
settings.add(FIPS_MODE_ENABLED);
return Collections.unmodifiableList(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.xpack.core.XPackFeatureSet;
import org.elasticsearch.xpack.core.XPackField;
import org.elasticsearch.xpack.core.XPackSettings;

import java.io.IOException;
import java.util.Map;

public class EnrichFeatureSet implements XPackFeatureSet {

private final boolean enabled;
private final XPackLicenseState licenseState;

@Inject
public EnrichFeatureSet(Settings settings, @Nullable XPackLicenseState licenseState) {
this.enabled = XPackSettings.ENRICH_ENABLED_SETTING.get(settings);
public EnrichFeatureSet(@Nullable XPackLicenseState licenseState) {
this.licenseState = licenseState;
}

Expand All @@ -42,7 +38,7 @@ public boolean available() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public FlattenedFeatureSetUsage(StreamInput input) throws IOException {
this.fieldCount = input.getVersion().onOrAfter(Version.V_7_6_0) ? input.readInt() : 0;
}

public FlattenedFeatureSetUsage(boolean available, boolean enabled, int fieldCount) {
super(XPackField.FLATTENED, available, enabled);
public FlattenedFeatureSetUsage(boolean available, int fieldCount) {
super(XPackField.FLATTENED, available, true);
this.fieldCount = fieldCount;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public LogstashFeatureSetUsage(StreamInput in) throws IOException {
super(in);
}

public LogstashFeatureSetUsage(boolean available, boolean enabled) {
super(XPackField.LOGSTASH, available, enabled);
public LogstashFeatureSetUsage(boolean available) {
super(XPackField.LOGSTASH, available, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public RollupFeatureSetUsage(StreamInput input) throws IOException {
super(input);
}

public RollupFeatureSetUsage(boolean available, boolean enabled) {
super(XPackField.ROLLUP, available, enabled);
public RollupFeatureSetUsage(boolean available) {
super(XPackField.ROLLUP, available, true);
}

@Override
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, boolean enabled, @Nullable SnapshotLifecycleStats slmStats) {
super(XPackField.SNAPSHOT_LIFECYCLE, available, enabled);
public SLMFeatureSetUsage(boolean available, @Nullable SnapshotLifecycleStats slmStats) {
super(XPackField.SNAPSHOT_LIFECYCLE, available, true);
this.slmStats = slmStats;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public SqlFeatureSetUsage(StreamInput in) throws IOException {
stats = in.readMap();
}

public SqlFeatureSetUsage(boolean available, boolean enabled, Map<String, Object> stats) {
super(XPackField.SQL, available, enabled);
public SqlFeatureSetUsage(boolean available, Map<String, Object> stats) {
super(XPackField.SQL, available, true);
this.stats = stats;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public TransformFeatureSetUsage(StreamInput in) throws IOException {
this.accumulatedStats = new TransformIndexerStats(in);
}

public TransformFeatureSetUsage(boolean available, boolean enabled, Map<String, Long> transformCountByState,
public TransformFeatureSetUsage(boolean available, Map<String, Long> transformCountByState,
TransformIndexerStats accumulatedStats) {
super(XPackField.TRANSFORM, available, enabled);
super(XPackField.TRANSFORM, available, true);
this.transformCountByState = Objects.requireNonNull(transformCountByState);
this.accumulatedStats = Objects.requireNonNull(accumulatedStats);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,25 @@ public class FlattenedFeatureSetUsageTests extends AbstractWireSerializingTestCa

@Override
protected FlattenedFeatureSetUsage createTestInstance() {
return new FlattenedFeatureSetUsage(randomBoolean(), randomBoolean(), randomIntBetween(0, 1000));
return new FlattenedFeatureSetUsage(randomBoolean(), randomIntBetween(0, 1000));
}

@Override
protected FlattenedFeatureSetUsage mutateInstance(FlattenedFeatureSetUsage instance) throws IOException {

boolean available = instance.available();
boolean enabled = instance.enabled();
int fieldCount = instance.fieldCount();

switch (between(0, 2)) {
switch (between(0, 1)) {
case 0:
available = !available;
break;
case 1:
enabled = !enabled;
break;
case 2:
fieldCount = randomValueOtherThan(instance.fieldCount(), () -> randomIntBetween(0, 1000));
break;
}

return new FlattenedFeatureSetUsage(available, enabled, fieldCount);
return new FlattenedFeatureSetUsage(available, fieldCount);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ protected TransformFeatureSetUsage createTestInstance() {
transformCountByState.put(randomFrom(IndexerState.values()).toString(), randomLong());
}

return new TransformFeatureSetUsage(randomBoolean(), randomBoolean(), transformCountByState,
TransformIndexerStatsTests.randomStats());
return new TransformFeatureSetUsage(randomBoolean(), transformCountByState, TransformIndexerStatsTests.randomStats());
}

@Override
Expand Down
Loading

0 comments on commit 3499fa9

Please sign in to comment.