Skip to content

Commit

Permalink
Remove data stream feature flag (#59572)
Browse files Browse the repository at this point in the history
so that it can used in the next minor release (7.9.0).

Backport of #59504 to 7.x branch.
Closes #53100
  • Loading branch information
martijnvg authored Jul 14, 2020
1 parent 3b688bf commit 35ae3d1
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 78 deletions.
11 changes: 0 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 1 addition & 7 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,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'
Expand Down Expand Up @@ -333,12 +333,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'
}
40 changes: 10 additions & 30 deletions server/src/main/java/org/elasticsearch/action/ActionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -627,13 +611,11 @@ public <Request extends ActionRequest, Response extends ActionResponse> 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);
Expand Down Expand Up @@ -793,13 +775,11 @@ public void initRestHandlers(Supplier<DiscoveryNodes> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 0 additions & 13 deletions x-pack/plugin/data-streams/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.elasticsearch.gradle.info.BuildParams

evaluationDependsOn(xpackModule('core'))

apply plugin: 'elasticsearch.esplugin'
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,11 +31,7 @@ public DataStreamsPlugin(Settings settings) {

@Override
public Map<String, MetadataFieldMapper.TypeParser> 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<Module> createGuiceModules() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 35ae3d1

Please sign in to comment.