Search in sources :

Example 6 with NoopIndexingServiceClient

use of org.apache.druid.client.indexing.NoopIndexingServiceClient in project druid by druid-io.

the class RealtimeIndexTaskTest method makeToolbox.

private TaskToolbox makeToolbox(final Task task, final TaskStorage taskStorage, final IndexerMetadataStorageCoordinator mdc, final File directory) {
    final TaskConfig taskConfig = new TaskConfig(directory.getPath(), null, null, 50000, null, true, null, null, null, false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final TaskLockbox taskLockbox = new TaskLockbox(taskStorage, mdc);
    try {
        taskStorage.insert(task, TaskStatus.running(task.getId()));
    } catch (EntryExistsException e) {
    // suppress
    }
    taskLockbox.syncFromStorage();
    final TaskActionToolbox taskActionToolbox = new TaskActionToolbox(taskLockbox, taskStorage, mdc, EMITTER, EasyMock.createMock(SupervisorManager.class));
    final TaskActionClientFactory taskActionClientFactory = new LocalTaskActionClientFactory(taskStorage, taskActionToolbox, new TaskAuditLogConfig(false));
    final QueryRunnerFactoryConglomerate conglomerate = new DefaultQueryRunnerFactoryConglomerate(ImmutableMap.of(TimeseriesQuery.class, new TimeseriesQueryRunnerFactory(new TimeseriesQueryQueryToolChest(), new TimeseriesQueryEngine(), new QueryWatcher() {

        @Override
        public void registerQueryFuture(Query query, ListenableFuture future) {
        // do nothing
        }
    })));
    handOffCallbacks = new ConcurrentHashMap<>();
    final SegmentHandoffNotifierFactory handoffNotifierFactory = new SegmentHandoffNotifierFactory() {

        @Override
        public SegmentHandoffNotifier createSegmentHandoffNotifier(String dataSource) {
            return new SegmentHandoffNotifier() {

                @Override
                public boolean registerSegmentHandoffCallback(SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable) {
                    handOffCallbacks.put(descriptor, new Pair<>(exec, handOffRunnable));
                    return true;
                }

                @Override
                public void start() {
                // Noop
                }

                @Override
                public void close() {
                // Noop
                }
            };
        }
    };
    final TestUtils testUtils = new TestUtils();
    final TaskToolboxFactory toolboxFactory = new TaskToolboxFactory(taskConfig, // taskExecutorNode
    null, taskActionClientFactory, EMITTER, new TestDataSegmentPusher(), new TestDataSegmentKiller(), // DataSegmentMover
    null, // DataSegmentArchiver
    null, new TestDataSegmentAnnouncer(), EasyMock.createNiceMock(DataSegmentServerAnnouncer.class), handoffNotifierFactory, () -> conglomerate, DirectQueryProcessingPool.INSTANCE, NoopJoinableFactory.INSTANCE, () -> EasyMock.createMock(MonitorScheduler.class), new SegmentCacheManagerFactory(testUtils.getTestObjectMapper()), testUtils.getTestObjectMapper(), testUtils.getTestIndexIO(), MapCache.create(1024), new CacheConfig(), new CachePopulatorStats(), testUtils.getTestIndexMergerV9(), EasyMock.createNiceMock(DruidNodeAnnouncer.class), EasyMock.createNiceMock(DruidNode.class), new LookupNodeService("tier"), new DataNodeService("tier", 1000, ServerType.INDEXER_EXECUTOR, 0), new NoopTestTaskReportFileWriter(), null, AuthTestUtils.TEST_AUTHORIZER_MAPPER, new NoopChatHandlerProvider(), testUtils.getRowIngestionMetersFactory(), new TestAppenderatorsManager(), new NoopIndexingServiceClient(), null, null, null);
    return toolboxFactory.build(task);
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) Query(org.apache.druid.query.Query) QueryWatcher(org.apache.druid.query.QueryWatcher) TaskActionClientFactory(org.apache.druid.indexing.common.actions.TaskActionClientFactory) LocalTaskActionClientFactory(org.apache.druid.indexing.common.actions.LocalTaskActionClientFactory) TestDataSegmentAnnouncer(org.apache.druid.indexing.test.TestDataSegmentAnnouncer) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) DruidNodeAnnouncer(org.apache.druid.discovery.DruidNodeAnnouncer) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) TaskAuditLogConfig(org.apache.druid.indexing.common.actions.TaskAuditLogConfig) AuthTestUtils(org.apache.druid.server.security.AuthTestUtils) TestUtils(org.apache.druid.indexing.common.TestUtils) QueryRunnerFactoryConglomerate(org.apache.druid.query.QueryRunnerFactoryConglomerate) DefaultQueryRunnerFactoryConglomerate(org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate) TimeseriesQueryEngine(org.apache.druid.query.timeseries.TimeseriesQueryEngine) Executor(java.util.concurrent.Executor) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) TaskToolboxFactory(org.apache.druid.indexing.common.TaskToolboxFactory) SegmentDescriptor(org.apache.druid.query.SegmentDescriptor) CachePopulatorStats(org.apache.druid.client.cache.CachePopulatorStats) TaskActionToolbox(org.apache.druid.indexing.common.actions.TaskActionToolbox) LocalTaskActionClientFactory(org.apache.druid.indexing.common.actions.LocalTaskActionClientFactory) CacheConfig(org.apache.druid.client.cache.CacheConfig) TestDataSegmentPusher(org.apache.druid.indexing.test.TestDataSegmentPusher) TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) MonitorScheduler(org.apache.druid.java.util.metrics.MonitorScheduler) NoopChatHandlerProvider(org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider) SegmentHandoffNotifier(org.apache.druid.segment.handoff.SegmentHandoffNotifier) SegmentCacheManagerFactory(org.apache.druid.indexing.common.SegmentCacheManagerFactory) DefaultQueryRunnerFactoryConglomerate(org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate) EntryExistsException(org.apache.druid.metadata.EntryExistsException) LookupNodeService(org.apache.druid.discovery.LookupNodeService) TestDataSegmentKiller(org.apache.druid.indexing.test.TestDataSegmentKiller) DataSegmentServerAnnouncer(org.apache.druid.server.coordination.DataSegmentServerAnnouncer) SegmentHandoffNotifierFactory(org.apache.druid.segment.handoff.SegmentHandoffNotifierFactory) SupervisorManager(org.apache.druid.indexing.overlord.supervisor.SupervisorManager) TimeseriesQueryRunnerFactory(org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory) TaskLockbox(org.apache.druid.indexing.overlord.TaskLockbox) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) DruidNode(org.apache.druid.server.DruidNode) DataNodeService(org.apache.druid.discovery.DataNodeService)

Example 7 with NoopIndexingServiceClient

use of org.apache.druid.client.indexing.NoopIndexingServiceClient in project druid by druid-io.

the class ClientCompactionTaskQuerySerdeTest method setupInjectablesInObjectMapper.

private static ObjectMapper setupInjectablesInObjectMapper(ObjectMapper objectMapper) {
    final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
    objectMapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()));
    GuiceInjectableValues injectableValues = new GuiceInjectableValues(GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> {
        binder.bind(AuthorizerMapper.class).toInstance(AuthTestUtils.TEST_AUTHORIZER_MAPPER);
        binder.bind(ChatHandlerProvider.class).toInstance(new NoopChatHandlerProvider());
        binder.bind(RowIngestionMetersFactory.class).toInstance(ROW_INGESTION_METERS_FACTORY);
        binder.bind(CoordinatorClient.class).toInstance(COORDINATOR_CLIENT);
        binder.bind(SegmentCacheManagerFactory.class).toInstance(new SegmentCacheManagerFactory(objectMapper));
        binder.bind(AppenderatorsManager.class).toInstance(APPENDERATORS_MANAGER);
        binder.bind(IndexingServiceClient.class).toInstance(new NoopIndexingServiceClient());
    })));
    objectMapper.setInjectableValues(injectableValues);
    objectMapper.registerSubtypes(new NamedType(ParallelIndexTuningConfig.class, "index_parallel"));
    return objectMapper;
}
Also used : AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) NoopChatHandlerProvider(org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) SegmentCacheManagerFactory(org.apache.druid.indexing.common.SegmentCacheManagerFactory) ChatHandlerProvider(org.apache.druid.segment.realtime.firehose.ChatHandlerProvider) NoopChatHandlerProvider(org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) AppenderatorsManager(org.apache.druid.segment.realtime.appenderator.AppenderatorsManager) AuthorizerMapper(org.apache.druid.server.security.AuthorizerMapper) CoordinatorClient(org.apache.druid.client.coordinator.CoordinatorClient) ParallelIndexTuningConfig(org.apache.druid.indexing.common.task.batch.parallel.ParallelIndexTuningConfig) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) RowIngestionMetersFactory(org.apache.druid.segment.incremental.RowIngestionMetersFactory)

Example 8 with NoopIndexingServiceClient

use of org.apache.druid.client.indexing.NoopIndexingServiceClient in project druid by druid-io.

the class SingleTaskBackgroundRunnerTest method setup.

@Before
public void setup() throws IOException {
    final TestUtils utils = new TestUtils();
    final DruidNode node = new DruidNode("testServer", "testHost", false, 1000, null, true, false);
    final TaskConfig taskConfig = new TaskConfig(temporaryFolder.newFile().toString(), null, null, 50000, null, true, null, null, null, false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final ServiceEmitter emitter = new NoopServiceEmitter();
    EmittingLogger.registerEmitter(emitter);
    final TaskToolboxFactory toolboxFactory = new TaskToolboxFactory(taskConfig, null, EasyMock.createMock(TaskActionClientFactory.class), emitter, new NoopDataSegmentPusher(), new NoopDataSegmentKiller(), new NoopDataSegmentMover(), new NoopDataSegmentArchiver(), new NoopDataSegmentAnnouncer(), null, null, null, null, NoopJoinableFactory.INSTANCE, null, new SegmentCacheManagerFactory(utils.getTestObjectMapper()), utils.getTestObjectMapper(), utils.getTestIndexIO(), null, null, null, utils.getTestIndexMergerV9(), null, node, null, null, new SingleFileTaskReportFileWriter(new File("fake")), null, AuthTestUtils.TEST_AUTHORIZER_MAPPER, new NoopChatHandlerProvider(), utils.getRowIngestionMetersFactory(), new TestAppenderatorsManager(), new NoopIndexingServiceClient(), null, null, null);
    runner = new SingleTaskBackgroundRunner(toolboxFactory, taskConfig, emitter, node, new ServerConfig());
}
Also used : ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) NoopDataSegmentArchiver(org.apache.druid.segment.loading.NoopDataSegmentArchiver) SingleFileTaskReportFileWriter(org.apache.druid.indexing.common.SingleFileTaskReportFileWriter) NoopDataSegmentPusher(org.apache.druid.segment.loading.NoopDataSegmentPusher) NoopDataSegmentKiller(org.apache.druid.segment.loading.NoopDataSegmentKiller) NoopDataSegmentAnnouncer(org.apache.druid.server.coordination.NoopDataSegmentAnnouncer) NoopChatHandlerProvider(org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider) SegmentCacheManagerFactory(org.apache.druid.indexing.common.SegmentCacheManagerFactory) TaskActionClientFactory(org.apache.druid.indexing.common.actions.TaskActionClientFactory) NoopDataSegmentMover(org.apache.druid.segment.loading.NoopDataSegmentMover) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) TestUtils(org.apache.druid.indexing.common.TestUtils) AuthTestUtils(org.apache.druid.server.security.AuthTestUtils) ServerConfig(org.apache.druid.server.initialization.ServerConfig) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) TaskToolboxFactory(org.apache.druid.indexing.common.TaskToolboxFactory) DruidNode(org.apache.druid.server.DruidNode) File(java.io.File) TestAppenderatorsManager(org.apache.druid.indexing.common.task.TestAppenderatorsManager) Before(org.junit.Before)

Example 9 with NoopIndexingServiceClient

use of org.apache.druid.client.indexing.NoopIndexingServiceClient in project druid by druid-io.

the class LocalIntermediaryDataManagerAutoCleanupTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig() {

        @Override
        public long getIntermediaryPartitionDiscoveryPeriodSec() {
            return 1;
        }

        @Override
        public long getIntermediaryPartitionCleanupPeriodSec() {
            return 2;
        }

        @Override
        public Period getIntermediaryPartitionTimeout() {
            return new Period("PT2S");
        }
    };
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(tempDir.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient() {

        @Override
        public Map<String, TaskStatus> getTaskStatuses(Set<String> taskIds) {
            final Map<String, TaskStatus> result = new HashMap<>();
            for (String taskId : taskIds) {
                result.put(taskId, new TaskStatus(taskId, TaskState.SUCCESS, 10));
            }
            return result;
        }
    };
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    intermediaryDataManager.start();
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Set(java.util.Set) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) HashMap(java.util.HashMap) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) Period(org.joda.time.Period) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) TaskStatus(org.apache.druid.client.indexing.TaskStatus) Before(org.junit.Before)

Example 10 with NoopIndexingServiceClient

use of org.apache.druid.client.indexing.NoopIndexingServiceClient in project druid by druid-io.

the class ShuffleDataSegmentPusherTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig();
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient();
    if (LOCAL.equals(intermediateDataStore)) {
        intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    } else if (DEEPSTORE.equals(intermediateDataStore)) {
        localDeepStore = temporaryFolder.newFolder("localStorage");
        intermediaryDataManager = new DeepStorageIntermediaryDataManager(new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig() {

            @Override
            public File getStorageDirectory() {
                return localDeepStore;
            }
        }));
    }
    intermediaryDataManager.start();
    segmentPusher = new ShuffleDataSegmentPusher("supervisorTaskId", "subTaskId", intermediaryDataManager);
    final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> binder.bind(LocalDataSegmentPuller.class)));
    mapper = new DefaultObjectMapper();
    mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
    mapper.setInjectableValues(new GuiceInjectableValues(injector));
    final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
    mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
Also used : Arrays(java.util.Arrays) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) Intervals(org.apache.druid.java.util.common.Intervals) RunWith(org.junit.runner.RunWith) CompressionUtils(org.apache.druid.utils.CompressionUtils) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) SegmentLoadingException(org.apache.druid.segment.loading.SegmentLoadingException) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Interval(org.joda.time.Interval) ImmutableList(com.google.common.collect.ImmutableList) Files(com.google.common.io.Files) LocalDataSegmentPuller(org.apache.druid.segment.loading.LocalDataSegmentPuller) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) After(org.junit.After) ByteSource(com.google.common.io.ByteSource) LoadSpec(org.apache.druid.segment.loading.LoadSpec) BucketNumberedShardSpec(org.apache.druid.timeline.partition.BucketNumberedShardSpec) Parameterized(org.junit.runners.Parameterized) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Before(org.junit.Before) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) Collection(java.util.Collection) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) IOException(java.io.IOException) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Ints(com.google.common.primitives.Ints) GuiceInjectors(org.apache.druid.guice.GuiceInjectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Injector(com.google.inject.Injector) Mockito(org.mockito.Mockito) List(java.util.List) Rule(org.junit.Rule) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) DataSegment(org.apache.druid.timeline.DataSegment) Optional(java.util.Optional) Assert(org.junit.Assert) Comparator(java.util.Comparator) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) TemporaryFolder(org.junit.rules.TemporaryFolder) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Injector(com.google.inject.Injector) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) Before(org.junit.Before)

Aggregations

NoopIndexingServiceClient (org.apache.druid.client.indexing.NoopIndexingServiceClient)13 TaskConfig (org.apache.druid.indexing.common.config.TaskConfig)12 SegmentCacheManagerFactory (org.apache.druid.indexing.common.SegmentCacheManagerFactory)9 NoopChatHandlerProvider (org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider)9 TaskToolboxFactory (org.apache.druid.indexing.common.TaskToolboxFactory)8 TaskActionClientFactory (org.apache.druid.indexing.common.actions.TaskActionClientFactory)7 File (java.io.File)6 SegmentHandoffNotifierFactory (org.apache.druid.segment.handoff.SegmentHandoffNotifierFactory)6 DruidNode (org.apache.druid.server.DruidNode)6 Before (org.junit.Before)6 Set (java.util.Set)5 CachePopulatorStats (org.apache.druid.client.cache.CachePopulatorStats)5 IndexingServiceClient (org.apache.druid.client.indexing.IndexingServiceClient)5 DataNodeService (org.apache.druid.discovery.DataNodeService)5 DruidNodeAnnouncer (org.apache.druid.discovery.DruidNodeAnnouncer)5 LookupNodeService (org.apache.druid.discovery.LookupNodeService)5 LocalTaskActionClientFactory (org.apache.druid.indexing.common.actions.LocalTaskActionClientFactory)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 ImmutableList (com.google.common.collect.ImmutableList)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)4