From c7ac1459827ce6f2b1cdfea261cbe31deb3b2f71 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Sun, 13 Aug 2023 17:15:35 +0700 Subject: [PATCH] Move downsample feature to its own xpack plugin --- x-pack/plugin/downsample/build.gradle | 21 ++++++ .../{rollup => downsample}/qa/build.gradle | 0 .../qa/rest/build.gradle | 0 .../xpack/downsample/DownsampleRestIT.java | 0 .../test/downsample/10_basic.yml | 0 .../test/downsample/20_unsupported_aggs.yml | 0 .../test/downsample/30_date_histogram.yml | 0 .../test/downsample/40_runtime_fields.yml | 0 .../downsample/50_auto_date_histogram.yml | 0 .../test/downsample/60_settings.yml | 0 .../AbstractDownsampleFieldProducer.java | 0 .../AggregateMetricFieldSerializer.java | 0 .../AggregateMetricFieldValueFetcher.java | 0 .../xpack/downsample/Downsample.java | 70 +++++++++++++++++++ .../downsample/DownsampleFieldSerializer.java | 0 .../xpack/downsample/FieldValueFetcher.java | 0 .../xpack/downsample/LabelFieldProducer.java | 0 .../xpack/downsample/MetricFieldProducer.java | 0 .../downsample/RestDownsampleAction.java | 0 .../xpack/downsample/RollupShardIndexer.java | 0 .../downsample/TimeseriesFieldTypeHelper.java | 0 .../downsample/TransportDownsampleAction.java | 0 .../TransportDownsampleIndexerAction.java | 3 +- .../DownsampleActionSingleNodeTests.java | 3 +- .../downsample/DownsampleDataStreamTests.java | 3 +- .../DownsampleTransportFailureTests.java | 3 +- .../downsample/LabelFieldProducerTests.java | 0 .../downsample/MetricFieldProducerTests.java | 0 .../TransportDownsampleActionTests.java | 0 x-pack/plugin/rollup/build.gradle | 2 - .../elasticsearch/xpack/rollup/Rollup.java | 26 +------ 31 files changed, 98 insertions(+), 33 deletions(-) create mode 100644 x-pack/plugin/downsample/build.gradle rename x-pack/plugin/{rollup => downsample}/qa/build.gradle (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/build.gradle (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/20_unsupported_aggs.yml (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/30_date_histogram.yml (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/40_runtime_fields.yml (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/50_auto_date_histogram.yml (100%) rename x-pack/plugin/{rollup => downsample}/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/60_settings.yml (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/AbstractDownsampleFieldProducer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldSerializer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldValueFetcher.java (100%) create mode 100644 x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/Downsample.java rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/DownsampleFieldSerializer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/LabelFieldProducer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/MetricFieldProducer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/TimeseriesFieldTypeHelper.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java (100%) rename x-pack/plugin/{rollup => downsample}/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java (98%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java (99%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java (99%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java (99%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/LabelFieldProducerTests.java (100%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/MetricFieldProducerTests.java (100%) rename x-pack/plugin/{rollup => downsample}/src/test/java/org/elasticsearch/xpack/downsample/TransportDownsampleActionTests.java (100%) diff --git a/x-pack/plugin/downsample/build.gradle b/x-pack/plugin/downsample/build.gradle new file mode 100644 index 0000000000000..d90a7979483a6 --- /dev/null +++ b/x-pack/plugin/downsample/build.gradle @@ -0,0 +1,21 @@ +apply plugin: 'elasticsearch.internal-es-plugin' +esplugin { + name 'x-pack-downsample' + description 'Elasticsearch Expanded Pack Plugin - Downsample' + classname 'org.elasticsearch.xpack.downsample.Downsample' + extendedPlugins = ['x-pack-aggregate-metric'] +} + +base { + archivesName = 'x-pack-downsample' +} + +dependencies { + compileOnly project(path: xpackModule('core')) + testImplementation project(':modules:data-streams') + testImplementation project(path: xpackModule('ilm')) + compileOnly project(path: xpackModule('mapper-aggregate-metric')) + testImplementation(testArtifact(project(xpackModule('core')))) +} + +addQaCheckDependencies(project) diff --git a/x-pack/plugin/rollup/qa/build.gradle b/x-pack/plugin/downsample/qa/build.gradle similarity index 100% rename from x-pack/plugin/rollup/qa/build.gradle rename to x-pack/plugin/downsample/qa/build.gradle diff --git a/x-pack/plugin/rollup/qa/rest/build.gradle b/x-pack/plugin/downsample/qa/rest/build.gradle similarity index 100% rename from x-pack/plugin/rollup/qa/rest/build.gradle rename to x-pack/plugin/downsample/qa/rest/build.gradle diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/20_unsupported_aggs.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/20_unsupported_aggs.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/20_unsupported_aggs.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/20_unsupported_aggs.yml diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/30_date_histogram.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/30_date_histogram.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/30_date_histogram.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/30_date_histogram.yml diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/40_runtime_fields.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/40_runtime_fields.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/40_runtime_fields.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/40_runtime_fields.yml diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/50_auto_date_histogram.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/50_auto_date_histogram.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/50_auto_date_histogram.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/50_auto_date_histogram.yml diff --git a/x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/60_settings.yml b/x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/60_settings.yml similarity index 100% rename from x-pack/plugin/rollup/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/60_settings.yml rename to x-pack/plugin/downsample/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample/60_settings.yml diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AbstractDownsampleFieldProducer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AbstractDownsampleFieldProducer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AbstractDownsampleFieldProducer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AbstractDownsampleFieldProducer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldSerializer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldSerializer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldSerializer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldSerializer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldValueFetcher.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldValueFetcher.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldValueFetcher.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateMetricFieldValueFetcher.java diff --git a/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/Downsample.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/Downsample.java new file mode 100644 index 0000000000000..f7867fdff9fff --- /dev/null +++ b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/Downsample.java @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +package org.elasticsearch.xpack.downsample; + +import org.elasticsearch.action.ActionRequest; +import org.elasticsearch.action.ActionResponse; +import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; +import org.elasticsearch.cluster.node.DiscoveryNodes; +import org.elasticsearch.common.settings.ClusterSettings; +import org.elasticsearch.common.settings.IndexScopedSettings; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; +import org.elasticsearch.common.util.concurrent.EsExecutors; +import org.elasticsearch.plugins.ActionPlugin; +import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.rest.RestController; +import org.elasticsearch.rest.RestHandler; +import org.elasticsearch.threadpool.ExecutorBuilder; +import org.elasticsearch.threadpool.FixedExecutorBuilder; +import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.xpack.core.downsample.DownsampleAction; +import org.elasticsearch.xpack.core.downsample.DownsampleIndexerAction; + +import java.util.List; +import java.util.function.Supplier; + +public class Downsample extends Plugin implements ActionPlugin { + + public static final String DOWSAMPLE_TASK_THREAD_POOL_NAME = "downsample_indexing"; + private static final int DOWNSAMPLE_TASK_THREAD_POOL_QUEUE_SIZE = 256; + + @Override + public List> getExecutorBuilders(Settings settings) { + final FixedExecutorBuilder downsample = new FixedExecutorBuilder( + settings, + DOWSAMPLE_TASK_THREAD_POOL_NAME, + ThreadPool.oneEighthAllocatedProcessors(EsExecutors.allocatedProcessors(settings)), + DOWNSAMPLE_TASK_THREAD_POOL_QUEUE_SIZE, + "xpack.downsample.thread_pool", + EsExecutors.TaskTrackingConfig.DO_NOT_TRACK + ); + return List.of(downsample); + } + + @Override + public List> getActions() { + return List.of( + new ActionHandler<>(DownsampleIndexerAction.INSTANCE, TransportDownsampleIndexerAction.class), + new ActionHandler<>(DownsampleAction.INSTANCE, TransportDownsampleAction.class) + ); + } + + @Override + public List getRestHandlers( + Settings settings, + RestController restController, + ClusterSettings clusterSettings, + IndexScopedSettings indexScopedSettings, + SettingsFilter settingsFilter, + IndexNameExpressionResolver indexNameExpressionResolver, + Supplier nodesInCluster + ) { + return List.of(new RestDownsampleAction()); + } +} diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/DownsampleFieldSerializer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleFieldSerializer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/DownsampleFieldSerializer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleFieldSerializer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/LabelFieldProducer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/LabelFieldProducer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/LabelFieldProducer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/LabelFieldProducer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/MetricFieldProducer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/MetricFieldProducer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/MetricFieldProducer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/MetricFieldProducer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TimeseriesFieldTypeHelper.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TimeseriesFieldTypeHelper.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TimeseriesFieldTypeHelper.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TimeseriesFieldTypeHelper.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java similarity index 100% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java similarity index 98% rename from x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java rename to x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java index a565a35f4ce88..fe095e8f26dbe 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java +++ b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleIndexerAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.xpack.core.ClientHelper; import org.elasticsearch.xpack.core.downsample.DownsampleIndexerAction; import org.elasticsearch.xpack.core.rollup.action.RollupShardTask; -import org.elasticsearch.xpack.rollup.Rollup; import java.io.IOException; import java.util.Arrays; @@ -68,7 +67,7 @@ public TransportDownsampleIndexerAction( indexNameExpressionResolver, DownsampleIndexerAction.Request::new, DownsampleIndexerAction.ShardDownsampleRequest::new, - Rollup.DOWSAMPLE_TASK_THREAD_POOL_NAME + Downsample.DOWSAMPLE_TASK_THREAD_POOL_NAME ); this.client = new OriginSettingClient(client, ClientHelper.ROLLUP_ORIGIN); this.clusterService = clusterService; diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java similarity index 99% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java index 6d88681149d06..942668843feee 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java +++ b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java @@ -86,7 +86,6 @@ import org.elasticsearch.xpack.core.rollup.action.RollupShardIndexerStatus; import org.elasticsearch.xpack.core.rollup.action.RollupShardTask; import org.elasticsearch.xpack.ilm.IndexLifecycle; -import org.elasticsearch.xpack.rollup.Rollup; import org.junit.Before; import java.io.IOException; @@ -150,7 +149,7 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase { protected Collection> getPlugins() { return List.of( LocalStateCompositeXPackPlugin.class, - Rollup.class, + Downsample.class, AggregateMetricMapperPlugin.class, DataStreamsPlugin.class, IndexLifecycle.class diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java similarity index 99% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java index aed478caa87ba..9be7165430e7e 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java +++ b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleDataStreamTests.java @@ -49,7 +49,6 @@ import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.xcontent.XContentType; import org.elasticsearch.xpack.core.downsample.DownsampleAction; -import org.elasticsearch.xpack.rollup.Rollup; import org.hamcrest.Matchers; import java.io.IOException; @@ -67,7 +66,7 @@ public class DownsampleDataStreamTests extends ESSingleNodeTestCase { @Override protected Collection> getPlugins() { - return List.of(Rollup.class, DataStreamsPlugin.class); + return List.of(Downsample.class, DataStreamsPlugin.class); } public void testDataStreamDownsample() throws ExecutionException, InterruptedException, IOException { diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java similarity index 99% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java index 7890463936a59..278449c4d62fe 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java +++ b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureTests.java @@ -38,7 +38,6 @@ import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin; import org.elasticsearch.xpack.core.downsample.DownsampleAction; import org.elasticsearch.xpack.core.downsample.DownsampleIndexerAction; -import org.elasticsearch.xpack.rollup.Rollup; import org.junit.Before; import java.io.IOException; @@ -160,7 +159,7 @@ public String workerName() { @Override protected Collection> nodePlugins() { - return List.of(LocalStateCompositeXPackPlugin.class, Rollup.class, AggregateMetricMapperPlugin.class); + return List.of(LocalStateCompositeXPackPlugin.class, Downsample.class, AggregateMetricMapperPlugin.class); } @Override diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/LabelFieldProducerTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/LabelFieldProducerTests.java similarity index 100% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/LabelFieldProducerTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/LabelFieldProducerTests.java diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/MetricFieldProducerTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/MetricFieldProducerTests.java similarity index 100% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/MetricFieldProducerTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/MetricFieldProducerTests.java diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/TransportDownsampleActionTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/TransportDownsampleActionTests.java similarity index 100% rename from x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/downsample/TransportDownsampleActionTests.java rename to x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/TransportDownsampleActionTests.java diff --git a/x-pack/plugin/rollup/build.gradle b/x-pack/plugin/rollup/build.gradle index db584228bd282..43f23efbcc36c 100644 --- a/x-pack/plugin/rollup/build.gradle +++ b/x-pack/plugin/rollup/build.gradle @@ -3,7 +3,6 @@ esplugin { name 'x-pack-rollup' description 'Elasticsearch Expanded Pack Plugin - Rollup' classname 'org.elasticsearch.xpack.rollup.Rollup' - extendedPlugins = ['x-pack-aggregate-metric'] } base { @@ -14,7 +13,6 @@ dependencies { compileOnly project(path: xpackModule('core')) testImplementation project(':modules:data-streams') testImplementation project(path: xpackModule('ilm')) - compileOnly project(path: xpackModule('mapper-aggregate-metric')) testImplementation(testArtifact(project(xpackModule('core')))) } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java index 7e6f807e5c4d3..4479d2456fa05 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java @@ -31,8 +31,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; -import org.elasticsearch.xpack.core.downsample.DownsampleAction; -import org.elasticsearch.xpack.core.downsample.DownsampleIndexerAction; import org.elasticsearch.xpack.core.rollup.RollupField; import org.elasticsearch.xpack.core.rollup.action.DeleteRollupJobAction; import org.elasticsearch.xpack.core.rollup.action.GetRollupCapsAction; @@ -42,9 +40,6 @@ import org.elasticsearch.xpack.core.rollup.action.RollupSearchAction; import org.elasticsearch.xpack.core.rollup.action.StartRollupJobAction; import org.elasticsearch.xpack.core.rollup.action.StopRollupJobAction; -import org.elasticsearch.xpack.downsample.RestDownsampleAction; -import org.elasticsearch.xpack.downsample.TransportDownsampleAction; -import org.elasticsearch.xpack.downsample.TransportDownsampleIndexerAction; import org.elasticsearch.xpack.rollup.action.TransportDeleteRollupJobAction; import org.elasticsearch.xpack.rollup.action.TransportGetRollupCapsAction; import org.elasticsearch.xpack.rollup.action.TransportGetRollupIndexCapsAction; @@ -79,8 +74,6 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin public static final int CURRENT_ROLLUP_VERSION = ROLLUP_VERSION_V2; public static final String TASK_THREAD_POOL_NAME = RollupField.NAME + "_indexing"; - public static final String DOWSAMPLE_TASK_THREAD_POOL_NAME = "downsample_indexing"; - public static final int DOWNSAMPLE_TASK_THREAD_POOL_QUEUE_SIZE = 256; public static final String ROLLUP_TEMPLATE_VERSION_FIELD = "rollup-version"; @@ -109,8 +102,7 @@ public List getRestHandlers( new RestDeleteRollupJobAction(), new RestGetRollupJobsAction(), new RestGetRollupCapsAction(), - new RestGetRollupIndexCapsAction(), - new RestDownsampleAction() // TSDB Downsampling + new RestGetRollupIndexCapsAction() ); } @@ -126,9 +118,7 @@ public List getRestHandlers( new ActionHandler<>(GetRollupCapsAction.INSTANCE, TransportGetRollupCapsAction.class), new ActionHandler<>(GetRollupIndexCapsAction.INSTANCE, TransportGetRollupIndexCapsAction.class), new ActionHandler<>(XPackUsageFeatureAction.ROLLUP, RollupUsageTransportAction.class), - new ActionHandler<>(XPackInfoFeatureAction.ROLLUP, RollupInfoTransportAction.class), - new ActionHandler<>(DownsampleIndexerAction.INSTANCE, TransportDownsampleIndexerAction.class), - new ActionHandler<>(DownsampleAction.INSTANCE, TransportDownsampleAction.class) + new ActionHandler<>(XPackInfoFeatureAction.ROLLUP, RollupInfoTransportAction.class) ); } @@ -142,17 +132,7 @@ public List> getExecutorBuilders(Settings settingsToUse) { "xpack.rollup.task_thread_pool", EsExecutors.TaskTrackingConfig.DO_NOT_TRACK ); - - final FixedExecutorBuilder downsample = new FixedExecutorBuilder( - settingsToUse, - Rollup.DOWSAMPLE_TASK_THREAD_POOL_NAME, - ThreadPool.oneEighthAllocatedProcessors(EsExecutors.allocatedProcessors(settingsToUse)), - Rollup.DOWNSAMPLE_TASK_THREAD_POOL_QUEUE_SIZE, - "xpack.downsample.thread_pool", - EsExecutors.TaskTrackingConfig.DO_NOT_TRACK - ); - - return List.of(rollup, downsample); + return List.of(rollup); } @Override