Search in sources :

Example 56 with NoopServiceEmitter

use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.

the class TaskQueueTest method testLockConfigTakePrecedenceThanDefaultTaskContext.

@Test
public void testLockConfigTakePrecedenceThanDefaultTaskContext() throws EntryExistsException {
    final TaskActionClientFactory actionClientFactory = createActionClientFactory();
    final TaskQueue taskQueue = new TaskQueue(new TaskLockConfig(), new TaskQueueConfig(null, null, null, null), new DefaultTaskConfig() {

        @Override
        public Map<String, Object> getContext() {
            return ImmutableMap.of(Tasks.FORCE_TIME_CHUNK_LOCK_KEY, false);
        }
    }, getTaskStorage(), new SimpleTaskRunner(actionClientFactory), actionClientFactory, getLockbox(), new NoopServiceEmitter());
    taskQueue.setActive(true);
    final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"));
    taskQueue.add(task);
    final List<Task> tasks = taskQueue.getTasks();
    Assert.assertEquals(1, tasks.size());
    final Task queuedTask = tasks.get(0);
    Assert.assertTrue(queuedTask.getContextValue(Tasks.FORCE_TIME_CHUNK_LOCK_KEY));
}
Also used : Task(org.apache.druid.indexing.common.task.Task) AbstractBatchIndexTask(org.apache.druid.indexing.common.task.AbstractBatchIndexTask) TaskActionClientFactory(org.apache.druid.indexing.common.actions.TaskActionClientFactory) TaskQueueConfig(org.apache.druid.indexing.overlord.config.TaskQueueConfig) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DefaultTaskConfig(org.apache.druid.indexing.overlord.config.DefaultTaskConfig) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) TaskLockConfig(org.apache.druid.indexing.overlord.config.TaskLockConfig) Test(org.junit.Test)

Example 57 with NoopServiceEmitter

use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.

the class TaskQueueTest method testSetUseLineageBasedSegmentAllocationByDefault.

@Test
public void testSetUseLineageBasedSegmentAllocationByDefault() throws EntryExistsException {
    final TaskActionClientFactory actionClientFactory = createActionClientFactory();
    final TaskQueue taskQueue = new TaskQueue(new TaskLockConfig(), new TaskQueueConfig(null, null, null, null), new DefaultTaskConfig(), getTaskStorage(), new SimpleTaskRunner(actionClientFactory), actionClientFactory, getLockbox(), new NoopServiceEmitter());
    taskQueue.setActive(true);
    final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"));
    taskQueue.add(task);
    final List<Task> tasks = taskQueue.getTasks();
    Assert.assertEquals(1, tasks.size());
    final Task queuedTask = tasks.get(0);
    Assert.assertTrue(queuedTask.getContextValue(SinglePhaseParallelIndexTaskRunner.CTX_USE_LINEAGE_BASED_SEGMENT_ALLOCATION_KEY));
}
Also used : Task(org.apache.druid.indexing.common.task.Task) AbstractBatchIndexTask(org.apache.druid.indexing.common.task.AbstractBatchIndexTask) TaskActionClientFactory(org.apache.druid.indexing.common.actions.TaskActionClientFactory) TaskQueueConfig(org.apache.druid.indexing.overlord.config.TaskQueueConfig) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DefaultTaskConfig(org.apache.druid.indexing.overlord.config.DefaultTaskConfig) TaskLockConfig(org.apache.druid.indexing.overlord.config.TaskLockConfig) Test(org.junit.Test)

Example 58 with NoopServiceEmitter

use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.

the class BrokerServerViewTest method setupViews.

private void setupViews(Set<String> watchedTiers, Set<String> ignoredTiers, boolean watchRealtimeTasks) throws Exception {
    baseView = new BatchServerInventoryView(zkPathsConfig, curator, jsonMapper, Predicates.alwaysTrue(), "test") {

        @Override
        public void registerSegmentCallback(Executor exec, final SegmentCallback callback) {
            super.registerSegmentCallback(exec, new SegmentCallback() {

                @Override
                public CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) {
                    CallbackAction res = callback.segmentAdded(server, segment);
                    segmentAddedLatch.countDown();
                    return res;
                }

                @Override
                public CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) {
                    CallbackAction res = callback.segmentRemoved(server, segment);
                    segmentRemovedLatch.countDown();
                    return res;
                }

                @Override
                public CallbackAction segmentViewInitialized() {
                    CallbackAction res = callback.segmentViewInitialized();
                    segmentViewInitLatch.countDown();
                    return res;
                }
            });
        }
    };
    brokerServerView = new BrokerServerView(EasyMock.createMock(QueryToolChestWarehouse.class), EasyMock.createMock(QueryWatcher.class), getSmileMapper(), EasyMock.createMock(HttpClient.class), baseView, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()), new NoopServiceEmitter(), new BrokerSegmentWatcherConfig() {

        @Override
        public Set<String> getWatchedTiers() {
            return watchedTiers;
        }

        @Override
        public boolean isWatchRealtimeTasks() {
            return watchRealtimeTasks;
        }

        @Override
        public Set<String> getIgnoredTiers() {
            return ignoredTiers;
        }
    });
    baseView.start();
}
Also used : NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DruidServerMetadata(org.apache.druid.server.coordination.DruidServerMetadata) DataSegment(org.apache.druid.timeline.DataSegment) Executor(java.util.concurrent.Executor) HighestPriorityTierSelectorStrategy(org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy) RandomServerSelectorStrategy(org.apache.druid.client.selector.RandomServerSelectorStrategy)

Example 59 with NoopServiceEmitter

use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.

the class DirectDruidClientTest method setup.

@Before
public void setup() {
    httpClient = EasyMock.createMock(HttpClient.class);
    serverSelector = new ServerSelector(dataSegment, new HighestPriorityTierSelectorStrategy(new ConnectionCountServerSelectorStrategy()));
    client = new DirectDruidClient(new ReflectionQueryToolChestWarehouse(), QueryRunnerTestHelper.NOOP_QUERYWATCHER, new DefaultObjectMapper(), httpClient, "http", hostName, new NoopServiceEmitter());
    queryableDruidServer = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 0), client);
    serverSelector.addServerAndUpdateSegment(queryableDruidServer, serverSelector.getSegment());
}
Also used : ServerSelector(org.apache.druid.client.selector.ServerSelector) HttpClient(org.apache.druid.java.util.http.client.HttpClient) HighestPriorityTierSelectorStrategy(org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy) ConnectionCountServerSelectorStrategy(org.apache.druid.client.selector.ConnectionCountServerSelectorStrategy) QueryableDruidServer(org.apache.druid.client.selector.QueryableDruidServer) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) ReflectionQueryToolChestWarehouse(org.apache.druid.query.ReflectionQueryToolChestWarehouse) QueryableDruidServer(org.apache.druid.client.selector.QueryableDruidServer) Before(org.junit.Before)

Example 60 with NoopServiceEmitter

use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.

the class QueryableModuleTest method makeInjector.

private Injector makeInjector(Properties properties) {
    Injector injector = Guice.createInjector(ImmutableList.of(new DruidGuiceExtensions(), new JacksonModule(), new ConfigModule(), new QueryRunnerFactoryModule(), new DruidProcessingConfigModule(), new BrokerProcessingModule(), new LifecycleModule(), binder -> {
        binder.bind(Properties.class).toInstance(properties);
    }, new QueryableModule()));
    ObjectMapper mapper = injector.getInstance(Key.get(ObjectMapper.class, Json.class));
    mapper.registerModules(new QueryableModule().getJacksonModules());
    mapper.setInjectableValues(new InjectableValues.Std().addValue(ServiceEmitter.class, new NoopServiceEmitter()));
    return injector;
}
Also used : RequestLoggerProvider(org.apache.druid.server.log.RequestLoggerProvider) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) Properties(java.util.Properties) EmittingRequestLogger(org.apache.druid.server.log.EmittingRequestLogger) NoopRequestLogger(org.apache.druid.server.log.NoopRequestLogger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Key(com.google.inject.Key) RequestLogger(org.apache.druid.server.log.RequestLogger) Test(org.junit.Test) Json(org.apache.druid.guice.annotations.Json) Injector(com.google.inject.Injector) EmittingRequestLoggerProvider(org.apache.druid.server.log.EmittingRequestLoggerProvider) ImmutableList(org.apache.curator.shaded.com.google.common.collect.ImmutableList) NoopRequestLoggerProvider(org.apache.druid.server.log.NoopRequestLoggerProvider) ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) Guice(com.google.inject.Guice) JacksonModule(org.apache.druid.jackson.JacksonModule) Assert(org.junit.Assert) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) Json(org.apache.druid.guice.annotations.Json) JacksonModule(org.apache.druid.jackson.JacksonModule) Injector(com.google.inject.Injector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)74 Test (org.junit.Test)36 Before (org.junit.Before)21 DefaultGenericQueryMetricsFactory (org.apache.druid.query.DefaultGenericQueryMetricsFactory)14 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)13 IOException (java.io.IOException)13 TaskActionClientFactory (org.apache.druid.indexing.common.actions.TaskActionClientFactory)12 ServerConfig (org.apache.druid.server.initialization.ServerConfig)12 Period (org.joda.time.Period)11 DefaultTaskConfig (org.apache.druid.indexing.overlord.config.DefaultTaskConfig)10 TaskLockConfig (org.apache.druid.indexing.overlord.config.TaskLockConfig)10 TaskQueueConfig (org.apache.druid.indexing.overlord.config.TaskQueueConfig)10 QueryInterruptedException (org.apache.druid.query.QueryInterruptedException)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 File (java.io.File)9 DataSegment (org.apache.druid.timeline.DataSegment)8 List (java.util.List)7 CountDownLatch (java.util.concurrent.CountDownLatch)7 HttpServletResponse (javax.servlet.http.HttpServletResponse)7 Response (javax.ws.rs.core.Response)7