Search in sources :

Example 11 with SegmentPublishResult

use of io.druid.indexing.overlord.SegmentPublishResult in project druid by druid-io.

the class IndexerSQLMetadataStorageCoordinatorTest method testTransactionalAnnounceFailDbNotNullWantDifferent.

@Test
public void testTransactionalAnnounceFailDbNotNullWantDifferent() throws IOException {
    final SegmentPublishResult result1 = coordinator.announceHistoricalSegments(ImmutableSet.of(defaultSegment), new ObjectMetadata(null), new ObjectMetadata(ImmutableMap.of("foo", "baz")));
    Assert.assertEquals(new SegmentPublishResult(ImmutableSet.of(defaultSegment), true), result1);
    final SegmentPublishResult result2 = coordinator.announceHistoricalSegments(ImmutableSet.of(defaultSegment2), new ObjectMetadata(ImmutableMap.of("foo", "qux")), new ObjectMetadata(ImmutableMap.of("foo", "baz")));
    Assert.assertEquals(new SegmentPublishResult(ImmutableSet.<DataSegment>of(), false), result2);
    // Should only be tried once per call.
    Assert.assertEquals(2, metadataUpdateCounter.get());
}
Also used : SegmentPublishResult(io.druid.indexing.overlord.SegmentPublishResult) ObjectMetadata(io.druid.indexing.overlord.ObjectMetadata) DataSegment(io.druid.timeline.DataSegment) Test(org.junit.Test)

Aggregations

SegmentPublishResult (io.druid.indexing.overlord.SegmentPublishResult)11 Test (org.junit.Test)8 ObjectMetadata (io.druid.indexing.overlord.ObjectMetadata)7 DataSegment (io.druid.timeline.DataSegment)7 Interval (org.joda.time.Interval)4 NoopTask (io.druid.indexing.common.task.NoopTask)3 Task (io.druid.indexing.common.task.Task)3 Handle (org.skife.jdbi.v2.Handle)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 ServiceMetricEvent (com.metamx.emitter.service.ServiceMetricEvent)1 TaskLock (io.druid.indexing.common.TaskLock)1 TaskToolbox (io.druid.indexing.common.TaskToolbox)1 LockAcquireAction (io.druid.indexing.common.actions.LockAcquireAction)1 LockListAction (io.druid.indexing.common.actions.LockListAction)1 SegmentAllocateAction (io.druid.indexing.common.actions.SegmentAllocateAction)1 SegmentTransactionalInsertAction (io.druid.indexing.common.actions.SegmentTransactionalInsertAction)1 TaskAction (io.druid.indexing.common.actions.TaskAction)1 TaskActionClient (io.druid.indexing.common.actions.TaskActionClient)1 DataSourceMetadata (io.druid.indexing.overlord.DataSourceMetadata)1 DataSegmentPusher (io.druid.segment.loading.DataSegmentPusher)1