Search in sources :

Example 1 with DruidCoordinatorSegmentMerger

use of io.druid.server.coordinator.helper.DruidCoordinatorSegmentMerger in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method merge.

/**
   * Runs DruidCoordinatorSegmentMerger on a particular set of segments and returns the list of requested merges.
   */
private static List<List<DataSegment>> merge(final Collection<DataSegment> segments) {
    final JacksonConfigManager configManager = EasyMock.createMock(JacksonConfigManager.class);
    EasyMock.expect(configManager.watch(DatasourceWhitelist.CONFIG_KEY, DatasourceWhitelist.class)).andReturn(new AtomicReference<DatasourceWhitelist>(null)).anyTimes();
    EasyMock.replay(configManager);
    final List<List<DataSegment>> retVal = Lists.newArrayList();
    final IndexingServiceClient indexingServiceClient = new IndexingServiceClient(null, null, null) {

        @Override
        public void mergeSegments(List<DataSegment> segmentsToMerge) {
            retVal.add(segmentsToMerge);
        }
    };
    final DruidCoordinatorSegmentMerger merger = new DruidCoordinatorSegmentMerger(indexingServiceClient, configManager);
    final DruidCoordinatorRuntimeParams params = DruidCoordinatorRuntimeParams.newBuilder().withAvailableSegments(ImmutableSet.copyOf(segments)).withDynamicConfigs(new CoordinatorDynamicConfig.Builder().withMergeBytesLimit(mergeBytesLimit).withMergeSegmentsLimit(mergeSegmentsLimit).build()).withEmitter(EasyMock.createMock(ServiceEmitter.class)).build();
    merger.run(params);
    return retVal;
}
Also used : IndexingServiceClient(io.druid.client.indexing.IndexingServiceClient) DruidCoordinatorSegmentMerger(io.druid.server.coordinator.helper.DruidCoordinatorSegmentMerger) JacksonConfigManager(io.druid.common.config.JacksonConfigManager) AtomicReference(java.util.concurrent.atomic.AtomicReference) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 IndexingServiceClient (io.druid.client.indexing.IndexingServiceClient)1 JacksonConfigManager (io.druid.common.config.JacksonConfigManager)1 DruidCoordinatorSegmentMerger (io.druid.server.coordinator.helper.DruidCoordinatorSegmentMerger)1 List (java.util.List)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1