From ac8aa35f37855eadb12f88f26234dae6f8f0b20b Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 14 Jul 2020 22:12:30 +0200 Subject: [PATCH] Remove data stream feature flag, (#59504) so that it can used in the next minor release (7.9.0). Closes #53100 --- build.gradle | 11 ----- server/build.gradle | 10 +---- .../elasticsearch/action/ActionModule.java | 40 +++++-------------- .../org/elasticsearch/test/TestCluster.java | 3 +- x-pack/plugin/data-streams/build.gradle | 13 ------ .../xpack/datastreams/DataStreamsPlugin.java | 8 +--- .../ml/integration/ClassificationIT.java | 2 - .../xpack/ml/integration/DatafeedJobsIT.java | 2 - .../xpack/ml/integration/RegressionIT.java | 2 - .../integration/TransformPivotRestIT.java | 2 - 10 files changed, 13 insertions(+), 80 deletions(-) diff --git a/build.gradle b/build.gradle index ba5841550837b..9fe92ce0d709f 100644 --- a/build.gradle +++ b/build.gradle @@ -484,17 +484,6 @@ allprojects { } } -// TODO: remove this once 7.7 is released and the 7.x branch is 7.8 -subprojects { - pluginManager.withPlugin('elasticsearch.testclusters') { - testClusters.all { - if (org.elasticsearch.gradle.info.BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.datastreams_feature_enabled', 'true' - } - } - } -} - subprojects { project.ext.disableTasks = { String... tasknames -> for (String taskname : tasknames) { diff --git a/server/build.gradle b/server/build.gradle index 1c85298ce75b8..bd20bc1c56d25 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -1,5 +1,3 @@ -import org.elasticsearch.gradle.info.BuildParams - /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -122,7 +120,7 @@ dependencies { // repackaged jna with native bits linked against all elastic supported platforms api "org.elasticsearch:jna:${versions.jna}" - + testImplementation(project(":test:framework")) { // tests use the locally compiled version of server exclude group: 'org.elasticsearch', module: 'server' @@ -333,12 +331,6 @@ licenseHeaders { excludes << 'org/elasticsearch/common/inject/**/*' } -tasks.named('internalClusterTest').configure { - if (org.elasticsearch.gradle.info.BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.datastreams_feature_enabled', 'true' - } -} - licenseHeaders { excludes << 'org/elasticsearch/client/documentation/placeholder.txt' } diff --git a/server/src/main/java/org/elasticsearch/action/ActionModule.java b/server/src/main/java/org/elasticsearch/action/ActionModule.java index 1ed6ba9a808dd..284fc9b2c80a1 100644 --- a/server/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/server/src/main/java/org/elasticsearch/action/ActionModule.java @@ -21,7 +21,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.Build; import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainAction; import org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction; import org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsAction; @@ -416,21 +415,6 @@ public class ActionModule extends AbstractModule { private static final Logger logger = LogManager.getLogger(ActionModule.class); private final boolean transportClient; - public static final boolean DATASTREAMS_FEATURE_ENABLED; - - static { - final String property = System.getProperty("es.datastreams_feature_enabled"); - if (Build.CURRENT.isSnapshot() || "true".equals(property)) { - DATASTREAMS_FEATURE_ENABLED = true; - } else if ("false".equals(property) || property == null) { - DATASTREAMS_FEATURE_ENABLED = false; - } else { - throw new IllegalArgumentException( - "expected es.datastreams_feature_enabled to be unset or [true|false] but was [" + property + "]" - ); - } - } - private final Settings settings; private final IndexNameExpressionResolver indexNameExpressionResolver; private final IndexScopedSettings indexScopedSettings; @@ -627,13 +611,11 @@ public void reg actionPlugins.stream().flatMap(p -> p.getActions().stream()).forEach(actions::register); // Data streams: - if (DATASTREAMS_FEATURE_ENABLED) { - actions.register(CreateDataStreamAction.INSTANCE, CreateDataStreamAction.TransportAction.class); - actions.register(DeleteDataStreamAction.INSTANCE, DeleteDataStreamAction.TransportAction.class); - actions.register(GetDataStreamAction.INSTANCE, GetDataStreamAction.TransportAction.class); - actions.register(ResolveIndexAction.INSTANCE, ResolveIndexAction.TransportAction.class); - actions.register(DataStreamsStatsAction.INSTANCE, DataStreamsStatsAction.TransportAction.class); - } + actions.register(CreateDataStreamAction.INSTANCE, CreateDataStreamAction.TransportAction.class); + actions.register(DeleteDataStreamAction.INSTANCE, DeleteDataStreamAction.TransportAction.class); + actions.register(GetDataStreamAction.INSTANCE, GetDataStreamAction.TransportAction.class); + actions.register(ResolveIndexAction.INSTANCE, ResolveIndexAction.TransportAction.class); + actions.register(DataStreamsStatsAction.INSTANCE, DataStreamsStatsAction.TransportAction.class); // Persistent tasks: actions.register(StartPersistentTaskAction.INSTANCE, StartPersistentTaskAction.TransportAction.class); @@ -793,13 +775,11 @@ public void initRestHandlers(Supplier nodesInCluster) { registerHandler.accept(new RestDeleteDanglingIndexAction()); // Data Stream API - if (DATASTREAMS_FEATURE_ENABLED) { - registerHandler.accept(new RestCreateDataStreamAction()); - registerHandler.accept(new RestDeleteDataStreamAction()); - registerHandler.accept(new RestGetDataStreamsAction()); - registerHandler.accept(new RestResolveIndexAction()); - registerHandler.accept(new RestDataStreamsStatsAction()); - } + registerHandler.accept(new RestCreateDataStreamAction()); + registerHandler.accept(new RestDeleteDataStreamAction()); + registerHandler.accept(new RestGetDataStreamsAction()); + registerHandler.accept(new RestResolveIndexAction()); + registerHandler.accept(new RestDataStreamsStatsAction()); // CAT API registerHandler.accept(new RestAllocationAction()); diff --git a/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java index 442d39e21ae79..130ec2ce8bd65 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java @@ -23,7 +23,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionModule; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.indices.datastream.DeleteDataStreamAction; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; @@ -141,7 +140,7 @@ public void assertAfterTest() throws IOException { */ public void wipeAllDataStreams() { // Feature flag may not be enabled in all gradle modules that use ESIntegTestCase - if (size() > 0 && ActionModule.DATASTREAMS_FEATURE_ENABLED) { + if (size() > 0) { AcknowledgedResponse response = client().admin().indices().deleteDataStream(new DeleteDataStreamAction.Request(new String[]{"*"})).actionGet(); assertAcked(response); diff --git a/x-pack/plugin/data-streams/build.gradle b/x-pack/plugin/data-streams/build.gradle index 1a4bed892fbb8..bf8169c8c52f7 100644 --- a/x-pack/plugin/data-streams/build.gradle +++ b/x-pack/plugin/data-streams/build.gradle @@ -1,5 +1,3 @@ -import org.elasticsearch.gradle.info.BuildParams - evaluationDependsOn(xpackModule('core')) apply plugin: 'elasticsearch.esplugin' @@ -13,17 +11,6 @@ esplugin { archivesBaseName = 'x-pack-data-streams' integTest.enabled = false -tasks.named('internalClusterTest').configure { - if (BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.datastreams_feature_enabled', 'true' - } -} -tasks.named('test').configure { - if (org.elasticsearch.gradle.info.BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.datastreams_feature_enabled', 'true' - } -} - dependencies { compileOnly project(path: xpackModule('core'), configuration: 'default') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') diff --git a/x-pack/plugin/data-streams/src/main/java/org/elasticsearch/xpack/datastreams/DataStreamsPlugin.java b/x-pack/plugin/data-streams/src/main/java/org/elasticsearch/xpack/datastreams/DataStreamsPlugin.java index f505a2ddfd36f..0c4ee6a0a8f2a 100644 --- a/x-pack/plugin/data-streams/src/main/java/org/elasticsearch/xpack/datastreams/DataStreamsPlugin.java +++ b/x-pack/plugin/data-streams/src/main/java/org/elasticsearch/xpack/datastreams/DataStreamsPlugin.java @@ -21,8 +21,6 @@ import java.util.List; import java.util.Map; -import static org.elasticsearch.action.ActionModule.DATASTREAMS_FEATURE_ENABLED; - public class DataStreamsPlugin extends Plugin implements ActionPlugin, MapperPlugin { private final boolean transportClientMode; @@ -33,11 +31,7 @@ public DataStreamsPlugin(Settings settings) { @Override public Map getMetadataMappers() { - if (DATASTREAMS_FEATURE_ENABLED) { - return Collections.singletonMap(DataStreamTimestampFieldMapper.NAME, new DataStreamTimestampFieldMapper.TypeParser()); - } else { - return Collections.emptyMap(); - } + return Collections.singletonMap(DataStreamTimestampFieldMapper.NAME, new DataStreamTimestampFieldMapper.TypeParser()); } public Collection createGuiceModules() { diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java index 392ab2cb7a5c5..5deda5def4302 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java @@ -8,7 +8,6 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionModule; import org.elasticsearch.action.DocWriteRequest; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.bulk.BulkRequestBuilder; @@ -147,7 +146,6 @@ public void testSingleNumericFeatureAndMixedTrainingAndNonTrainingRows() throws } public void testWithDatastreams() throws Exception { - assumeTrue("should only run if data streams are enabled", ActionModule.DATASTREAMS_FEATURE_ENABLED); initialize("classification_with_datastreams", true); String predictedClassField = KEYWORD_FIELD + "_prediction"; indexData(sourceIndex, 300, 50, KEYWORD_FIELD); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java index 8780347b52207..126bb2b7d80f0 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java @@ -7,7 +7,6 @@ import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.Version; -import org.elasticsearch.action.ActionModule; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse; @@ -103,7 +102,6 @@ public void testLookbackOnly() throws Exception { } public void testLookbackOnlyDataStream() throws Exception { - assumeTrue("should only run if data streams are enabled", ActionModule.DATASTREAMS_FEATURE_ENABLED); String mapping = "{\n" + " \"properties\": {\n" + " \"time\": {\n" + diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java index 7453bf176a656..262196617a8d9 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.ml.integration; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionModule; import org.elasticsearch.action.DocWriteRequest; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -399,7 +398,6 @@ public void testDependentVariableIsLong() throws Exception { } public void testWithDatastream() throws Exception { - assumeTrue("should only run if data streams are enabled", ActionModule.DATASTREAMS_FEATURE_ENABLED); initialize("regression_with_datastream"); String predictedClassField = DEPENDENT_VARIABLE_FIELD + "_prediction"; indexData(sourceIndex, 300, 50, true); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java index 8e15e379b918c..98e917d1ad8cc 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java @@ -8,7 +8,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.elasticsearch.action.ActionModule; import org.elasticsearch.client.Request; import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.Strings; @@ -97,7 +96,6 @@ public void testSimplePivot() throws Exception { } public void testSimpleDataStreamPivot() throws Exception { - assumeTrue("should only run if data streams are enabled", ActionModule.DATASTREAMS_FEATURE_ENABLED); String indexName = "reviews_data_stream"; createReviewsIndex(indexName, 1000, "date", true); String transformId = "simple_data_stream_pivot";