Search in sources :

Example 6 with RealtimeIndexTask

use of io.druid.indexing.common.task.RealtimeIndexTask in project druid by druid-io.

the class TaskLifecycleTest method testRealtimeIndexTaskFailure.

@Test(timeout = 60_000L)
public void testRealtimeIndexTaskFailure() throws Exception {
    dataSegmentPusher = new DataSegmentPusher() {

        @Deprecated
        @Override
        public String getPathForHadoop(String s) {
            return getPathForHadoop();
        }

        @Override
        public String getPathForHadoop() {
            throw new UnsupportedOperationException();
        }

        @Override
        public DataSegment push(File file, DataSegment dataSegment) throws IOException {
            throw new RuntimeException("FAILURE");
        }
    };
    tb = setUpTaskToolboxFactory(dataSegmentPusher, handoffNotifierFactory, mdc);
    taskRunner = setUpThreadPoolTaskRunner(tb);
    taskQueue = setUpTaskQueue(taskStorage, taskRunner);
    monitorScheduler.addMonitor(EasyMock.anyObject(Monitor.class));
    EasyMock.expectLastCall().atLeastOnce();
    monitorScheduler.removeMonitor(EasyMock.anyObject(Monitor.class));
    EasyMock.expectLastCall().anyTimes();
    EasyMock.replay(monitorScheduler, queryRunnerFactoryConglomerate);
    RealtimeIndexTask realtimeIndexTask = newRealtimeIndexTask();
    final String taskId = realtimeIndexTask.getId();
    taskQueue.start();
    taskQueue.add(realtimeIndexTask);
    // Wait for realtime index task to fail
    while (tsqa.getStatus(taskId).get().isRunnable()) {
        Thread.sleep(10);
    }
    Assert.assertTrue("Task should be in Failure state", tsqa.getStatus(taskId).get().isFailure());
    EasyMock.verify(monitorScheduler, queryRunnerFactoryConglomerate);
}
Also used : DataSegmentPusher(io.druid.segment.loading.DataSegmentPusher) Monitor(com.metamx.metrics.Monitor) RealtimeIndexTask(io.druid.indexing.common.task.RealtimeIndexTask) IOException(java.io.IOException) File(java.io.File) DataSegment(io.druid.timeline.DataSegment) FireDepartmentTest(io.druid.segment.realtime.FireDepartmentTest) Test(org.junit.Test)

Aggregations

RealtimeIndexTask (io.druid.indexing.common.task.RealtimeIndexTask)6 Test (org.junit.Test)5 RealtimeIOConfig (io.druid.segment.indexing.RealtimeIOConfig)4 FireDepartment (io.druid.segment.realtime.FireDepartment)4 TaskResource (io.druid.indexing.common.task.TaskResource)3 DataSchema (io.druid.segment.indexing.DataSchema)3 RealtimeTuningConfig (io.druid.segment.indexing.RealtimeTuningConfig)3 File (java.io.File)3 Monitor (com.metamx.metrics.Monitor)2 Task (io.druid.indexing.common.task.Task)2 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)2 UniformGranularitySpec (io.druid.segment.indexing.granularity.UniformGranularitySpec)2 FireDepartmentMetrics (io.druid.segment.realtime.FireDepartmentMetrics)2 FireDepartmentTest (io.druid.segment.realtime.FireDepartmentTest)2 LocalFirehoseFactory (io.druid.segment.realtime.firehose.LocalFirehoseFactory)2 Plumber (io.druid.segment.realtime.plumber.Plumber)2 PlumberSchool (io.druid.segment.realtime.plumber.PlumberSchool)2 DataSegment (io.druid.timeline.DataSegment)2 Executor (java.util.concurrent.Executor)2 Period (org.joda.time.Period)2