|
@@ -12,9 +12,7 @@ import org.elasticsearch.action.ActionResponse;
|
|
|
import org.elasticsearch.client.internal.Client;
|
|
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
|
|
-import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
|
|
import org.elasticsearch.cluster.service.ClusterService;
|
|
|
-import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
|
|
import org.elasticsearch.common.scheduler.SchedulerEngine;
|
|
|
import org.elasticsearch.common.settings.ClusterSettings;
|
|
|
import org.elasticsearch.common.settings.IndexScopedSettings;
|
|
@@ -22,30 +20,17 @@ import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.settings.SettingsFilter;
|
|
|
import org.elasticsearch.common.settings.SettingsModule;
|
|
|
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
|
|
-import org.elasticsearch.env.Environment;
|
|
|
-import org.elasticsearch.env.NodeEnvironment;
|
|
|
-import org.elasticsearch.indices.IndicesService;
|
|
|
-import org.elasticsearch.persistent.PersistentTaskParams;
|
|
|
-import org.elasticsearch.persistent.PersistentTaskState;
|
|
|
import org.elasticsearch.persistent.PersistentTasksExecutor;
|
|
|
import org.elasticsearch.plugins.ActionPlugin;
|
|
|
import org.elasticsearch.plugins.PersistentTaskPlugin;
|
|
|
import org.elasticsearch.plugins.Plugin;
|
|
|
-import org.elasticsearch.repositories.RepositoriesService;
|
|
|
import org.elasticsearch.rest.RestController;
|
|
|
import org.elasticsearch.rest.RestHandler;
|
|
|
-import org.elasticsearch.script.ScriptService;
|
|
|
import org.elasticsearch.threadpool.ExecutorBuilder;
|
|
|
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
|
|
import org.elasticsearch.threadpool.ThreadPool;
|
|
|
-import org.elasticsearch.tracing.Tracer;
|
|
|
-import org.elasticsearch.watcher.ResourceWatcherService;
|
|
|
-import org.elasticsearch.xcontent.NamedXContentRegistry;
|
|
|
-import org.elasticsearch.xcontent.ParseField;
|
|
|
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;
|
|
@@ -53,15 +38,8 @@ import org.elasticsearch.xpack.core.rollup.action.GetRollupIndexCapsAction;
|
|
|
import org.elasticsearch.xpack.core.rollup.action.GetRollupJobsAction;
|
|
|
import org.elasticsearch.xpack.core.rollup.action.PutRollupJobAction;
|
|
|
import org.elasticsearch.xpack.core.rollup.action.RollupSearchAction;
|
|
|
-import org.elasticsearch.xpack.core.rollup.action.RollupShardPersistentTaskState;
|
|
|
-import org.elasticsearch.xpack.core.rollup.action.RollupShardTask;
|
|
|
import org.elasticsearch.xpack.core.rollup.action.StartRollupJobAction;
|
|
|
import org.elasticsearch.xpack.core.rollup.action.StopRollupJobAction;
|
|
|
-import org.elasticsearch.xpack.downsample.DownsampleShardTaskParams;
|
|
|
-import org.elasticsearch.xpack.downsample.RestDownsampleAction;
|
|
|
-import org.elasticsearch.xpack.downsample.RollupShardPersistentTaskExecutor;
|
|
|
-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;
|
|
@@ -82,7 +60,6 @@ import org.elasticsearch.xpack.rollup.rest.RestStopRollupJobAction;
|
|
|
|
|
|
import java.time.Clock;
|
|
|
import java.util.Arrays;
|
|
|
-import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
@@ -96,14 +73,11 @@ 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";
|
|
|
|
|
|
private final SetOnce<SchedulerEngine> schedulerEngine = new SetOnce<>();
|
|
|
private final Settings settings;
|
|
|
- private IndicesService indicesService;
|
|
|
|
|
|
public Rollup(Settings settings) {
|
|
|
this.settings = settings;
|
|
@@ -127,8 +101,7 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
|
|
new RestDeleteRollupJobAction(),
|
|
|
new RestGetRollupJobsAction(),
|
|
|
new RestGetRollupCapsAction(),
|
|
|
- new RestGetRollupIndexCapsAction(),
|
|
|
- new RestDownsampleAction() // TSDB Downsampling
|
|
|
+ new RestGetRollupIndexCapsAction()
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -144,9 +117,7 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
|
|
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)
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -160,17 +131,7 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
|
|
"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
|
|
@@ -182,15 +143,7 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
|
|
IndexNameExpressionResolver expressionResolver
|
|
|
) {
|
|
|
schedulerEngine.set(new SchedulerEngine(settings, getClock()));
|
|
|
- return List.of(
|
|
|
- new RollupJobTask.RollupJobPersistentTasksExecutor(client, schedulerEngine.get(), threadPool),
|
|
|
- new RollupShardPersistentTaskExecutor(
|
|
|
- client,
|
|
|
- this.indicesService,
|
|
|
- RollupShardTask.TASK_NAME,
|
|
|
- Rollup.DOWSAMPLE_TASK_THREAD_POOL_NAME
|
|
|
- )
|
|
|
- );
|
|
|
+ return List.of(new RollupJobTask.RollupJobPersistentTasksExecutor(client, schedulerEngine.get(), threadPool));
|
|
|
}
|
|
|
|
|
|
// overridable by tests
|
|
@@ -204,74 +157,4 @@ public class Rollup extends Plugin implements ActionPlugin, PersistentTaskPlugin
|
|
|
schedulerEngine.get().stop();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<NamedXContentRegistry.Entry> getNamedXContent() {
|
|
|
- return List.of(
|
|
|
- new NamedXContentRegistry.Entry(
|
|
|
- PersistentTaskState.class,
|
|
|
- new ParseField(RollupShardPersistentTaskState.NAME),
|
|
|
- RollupShardPersistentTaskState::fromXContent
|
|
|
- ),
|
|
|
- new NamedXContentRegistry.Entry(
|
|
|
- PersistentTaskParams.class,
|
|
|
- new ParseField(DownsampleShardTaskParams.NAME),
|
|
|
- DownsampleShardTaskParams::fromXContent
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
|
|
|
- return List.of(
|
|
|
- new NamedWriteableRegistry.Entry(
|
|
|
- PersistentTaskState.class,
|
|
|
- RollupShardPersistentTaskState.NAME,
|
|
|
- RollupShardPersistentTaskState::readFromStream
|
|
|
- ),
|
|
|
- new NamedWriteableRegistry.Entry(
|
|
|
- PersistentTaskParams.class,
|
|
|
- DownsampleShardTaskParams.NAME,
|
|
|
- DownsampleShardTaskParams::readFromStream
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Collection<Object> createComponents(
|
|
|
- final Client client,
|
|
|
- final ClusterService clusterService,
|
|
|
- final ThreadPool threadPool,
|
|
|
- final ResourceWatcherService resourceWatcherService,
|
|
|
- final ScriptService scriptService,
|
|
|
- final NamedXContentRegistry xContentRegistry,
|
|
|
- final Environment environment,
|
|
|
- final NodeEnvironment nodeEnvironment,
|
|
|
- final NamedWriteableRegistry namedWriteableRegistry,
|
|
|
- final IndexNameExpressionResolver indexNameExpressionResolver,
|
|
|
- final Supplier<RepositoriesService> repositoriesServiceSupplier,
|
|
|
- final Tracer tracer,
|
|
|
- final AllocationService allocationService,
|
|
|
- final IndicesService indicesService
|
|
|
- ) {
|
|
|
- final Collection<Object> components = super.createComponents(
|
|
|
- client,
|
|
|
- clusterService,
|
|
|
- threadPool,
|
|
|
- resourceWatcherService,
|
|
|
- scriptService,
|
|
|
- xContentRegistry,
|
|
|
- environment,
|
|
|
- nodeEnvironment,
|
|
|
- namedWriteableRegistry,
|
|
|
- indexNameExpressionResolver,
|
|
|
- repositoriesServiceSupplier,
|
|
|
- tracer,
|
|
|
- allocationService,
|
|
|
- indicesService
|
|
|
- );
|
|
|
-
|
|
|
- this.indicesService = indicesService;
|
|
|
- return components;
|
|
|
- }
|
|
|
}
|