Search in sources :

Example 11 with RandomServerSelectorStrategy

use of org.apache.druid.client.selector.RandomServerSelectorStrategy in project druid by druid-io.

the class CachingClusteredClientTest method makeMockHashBasedSelector.

private ServerSelector makeMockHashBasedSelector(DruidServer server, List<String> partitionDimensions, @Nullable HashPartitionFunction partitionFunction, int partitionNum, int partitions) {
    final DataSegment segment = new DataSegment(SegmentId.dummy(DATA_SOURCE), null, null, null, new HashBasedNumberedShardSpec(partitionNum, partitions, partitionNum, partitions, partitionDimensions, partitionFunction, ServerTestHelper.MAPPER), null, 9, 0L);
    ServerSelector selector = new ServerSelector(segment, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()));
    selector.addServerAndUpdateSegment(new QueryableDruidServer(server, null), segment);
    return selector;
}
Also used : HashBasedNumberedShardSpec(org.apache.druid.timeline.partition.HashBasedNumberedShardSpec) ServerSelector(org.apache.druid.client.selector.ServerSelector) HighestPriorityTierSelectorStrategy(org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy) DataSegment(org.apache.druid.timeline.DataSegment) RandomServerSelectorStrategy(org.apache.druid.client.selector.RandomServerSelectorStrategy) QueryableDruidServer(org.apache.druid.client.selector.QueryableDruidServer)

Aggregations

HighestPriorityTierSelectorStrategy (org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy)11 RandomServerSelectorStrategy (org.apache.druid.client.selector.RandomServerSelectorStrategy)11 DataSegment (org.apache.druid.timeline.DataSegment)11 ServerSelector (org.apache.druid.client.selector.ServerSelector)9 QueryableDruidServer (org.apache.druid.client.selector.QueryableDruidServer)7 ResponseContext (org.apache.druid.query.context.ResponseContext)4 MultipleIntervalSegmentSpec (org.apache.druid.query.spec.MultipleIntervalSegmentSpec)4 Interval (org.joda.time.Interval)4 Test (org.junit.Test)4 NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Executor (java.util.concurrent.Executor)2 MapCache (org.apache.druid.client.cache.MapCache)2 TimeBoundaryQuery (org.apache.druid.query.timeboundary.TimeBoundaryQuery)2 Iterators (com.google.common.collect.Iterators)1 Ordering (com.google.common.collect.Ordering)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1