use of org.apache.druid.client.selector.RandomServerSelectorStrategy in project druid by druid-io.
the class DatasourceOptimizerTest method setupViews.
private void setupViews() 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) {
return callback.segmentAdded(server, segment);
}
@Override
public CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) {
return callback.segmentRemoved(server, segment);
}
@Override
public CallbackAction segmentViewInitialized() {
return callback.segmentViewInitialized();
}
});
}
};
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());
baseView.start();
}
use of org.apache.druid.client.selector.RandomServerSelectorStrategy in project druid by druid-io.
the class CachingClusteredClientTest method makeMockSingleDimensionSelector.
private ServerSelector makeMockSingleDimensionSelector(DruidServer server, String dimension, String start, String end, int partitionNum) {
final DataSegment segment = new DataSegment(SegmentId.dummy(DATA_SOURCE), null, null, null, new SingleDimensionShardSpec(dimension, start, end, partitionNum, SingleDimensionShardSpec.UNKNOWN_NUM_CORE_PARTITIONS), null, 9, 0L);
ServerSelector selector = new ServerSelector(segment, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()));
selector.addServerAndUpdateSegment(new QueryableDruidServer(server, null), segment);
return selector;
}
use of org.apache.druid.client.selector.RandomServerSelectorStrategy 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();
}
use of org.apache.druid.client.selector.RandomServerSelectorStrategy in project druid by druid-io.
the class ClientInfoResourceTest method addSegmentWithShardSpec.
private void addSegmentWithShardSpec(VersionedIntervalTimeline<String, ServerSelector> timeline, DruidServer server, String interval, List<String> dims, List<String> metrics, String version, ShardSpec shardSpec) {
DataSegment segment = DataSegment.builder().dataSource(dataSource).interval(Intervals.of(interval)).version(version).dimensions(dims).metrics(metrics).shardSpec(shardSpec).size(1).build();
server.addDataSegment(segment);
ServerSelector ss = new ServerSelector(segment, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()));
timeline.add(Intervals.of(interval), version, shardSpec.createChunk(ss));
}
use of org.apache.druid.client.selector.RandomServerSelectorStrategy in project druid by druid-io.
the class ClientInfoResourceTest method addSegment.
private void addSegment(VersionedIntervalTimeline<String, ServerSelector> timeline, DruidServer server, String interval, List<String> dims, List<String> metrics, String version) {
DataSegment segment = DataSegment.builder().dataSource(dataSource).interval(Intervals.of(interval)).version(version).dimensions(dims).metrics(metrics).size(1).build();
server.addDataSegment(segment);
ServerSelector ss = new ServerSelector(segment, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()));
timeline.add(Intervals.of(interval), version, new SingleElementPartitionChunk<ServerSelector>(ss));
}
Aggregations