Search in sources :

Example 1 with BrokerSegmentWatcherConfig

use of org.apache.druid.client.BrokerSegmentWatcherConfig 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();
}
Also used : BatchServerInventoryView(org.apache.druid.client.BatchServerInventoryView) Executor(java.util.concurrent.Executor) HighestPriorityTierSelectorStrategy(org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy) BrokerServerView(org.apache.druid.client.BrokerServerView) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DruidServerMetadata(org.apache.druid.server.coordination.DruidServerMetadata) DataSegment(org.apache.druid.timeline.DataSegment) BrokerSegmentWatcherConfig(org.apache.druid.client.BrokerSegmentWatcherConfig) RandomServerSelectorStrategy(org.apache.druid.client.selector.RandomServerSelectorStrategy)

Example 2 with BrokerSegmentWatcherConfig

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

the class CalciteTests method createMockSystemSchema.

public static SystemSchema createMockSystemSchema(final DruidSchema druidSchema, final SpecificSegmentsQuerySegmentWalker walker, final PlannerConfig plannerConfig, final AuthorizerMapper authorizerMapper) {
    final DruidNode coordinatorNode = new DruidNode("test-coordinator", "dummy", false, 8081, null, true, false);
    FakeDruidNodeDiscoveryProvider provider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.COORDINATOR, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.COORDINATOR, coordinatorNode))));
    final DruidNode overlordNode = new DruidNode("test-overlord", "dummy", false, 8090, null, true, false);
    FakeDruidNodeDiscoveryProvider overlordProvider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.OVERLORD, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.OVERLORD, coordinatorNode))));
    final DruidLeaderClient druidLeaderClient = new DruidLeaderClient(new FakeHttpClient(), provider, NodeRole.COORDINATOR, "/simple/leader") {

        @Override
        public String findCurrentLeader() {
            return coordinatorNode.getHostAndPortToUse();
        }
    };
    final DruidLeaderClient overlordLeaderClient = new DruidLeaderClient(new FakeHttpClient(), overlordProvider, NodeRole.OVERLORD, "/simple/leader") {

        @Override
        public String findCurrentLeader() {
            return overlordNode.getHostAndPortToUse();
        }
    };
    return new SystemSchema(druidSchema, new MetadataSegmentView(druidLeaderClient, getJsonMapper(), new BrokerSegmentWatcherConfig(), plannerConfig), new TestServerInventoryView(walker.getSegments()), new FakeServerInventoryView(), authorizerMapper, druidLeaderClient, overlordLeaderClient, provider, getJsonMapper());
}
Also used : SystemSchema(org.apache.druid.sql.calcite.schema.SystemSchema) NamedSystemSchema(org.apache.druid.sql.calcite.schema.NamedSystemSchema) DiscoveryDruidNode(org.apache.druid.discovery.DiscoveryDruidNode) DruidNode(org.apache.druid.server.DruidNode) DruidLeaderClient(org.apache.druid.discovery.DruidLeaderClient) BrokerSegmentWatcherConfig(org.apache.druid.client.BrokerSegmentWatcherConfig) MetadataSegmentView(org.apache.druid.sql.calcite.schema.MetadataSegmentView)

Aggregations

BrokerSegmentWatcherConfig (org.apache.druid.client.BrokerSegmentWatcherConfig)2 Executor (java.util.concurrent.Executor)1 BatchServerInventoryView (org.apache.druid.client.BatchServerInventoryView)1 BrokerServerView (org.apache.druid.client.BrokerServerView)1 HighestPriorityTierSelectorStrategy (org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy)1 RandomServerSelectorStrategy (org.apache.druid.client.selector.RandomServerSelectorStrategy)1 DiscoveryDruidNode (org.apache.druid.discovery.DiscoveryDruidNode)1 DruidLeaderClient (org.apache.druid.discovery.DruidLeaderClient)1 DruidNode (org.apache.druid.server.DruidNode)1 DruidServerMetadata (org.apache.druid.server.coordination.DruidServerMetadata)1 NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)1 MetadataSegmentView (org.apache.druid.sql.calcite.schema.MetadataSegmentView)1 NamedSystemSchema (org.apache.druid.sql.calcite.schema.NamedSystemSchema)1 SystemSchema (org.apache.druid.sql.calcite.schema.SystemSchema)1 DataSegment (org.apache.druid.timeline.DataSegment)1