Search in sources :

Example 1 with PotentiallyGzippedCompressionProvider

use of org.apache.druid.curator.PotentiallyGzippedCompressionProvider in project druid by druid-io.

the class BatchServerInventoryViewTest method setUp.

@Before
public void setUp() throws Exception {
    testingCluster = new TestingCluster(1);
    testingCluster.start();
    cf = CuratorFrameworkFactory.builder().connectString(testingCluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1, 10)).compressionProvider(new PotentiallyGzippedCompressionProvider(true)).build();
    cf.start();
    cf.blockUntilConnected();
    cf.create().creatingParentsIfNeeded().forPath(TEST_BASE_PATH);
    jsonMapper = TestHelper.makeJsonMapper();
    announcer = new Announcer(cf, Execs.directExecutor());
    announcer.start();
    DruidServerMetadata serverMetadata = new DruidServerMetadata("id", "host", null, Long.MAX_VALUE, ServerType.HISTORICAL, "tier", 0);
    ZkPathsConfig zkPathsConfig = new ZkPathsConfig() {

        @Override
        public String getBase() {
            return TEST_BASE_PATH;
        }
    };
    serverAnnouncer = new CuratorDataSegmentServerAnnouncer(serverMetadata, zkPathsConfig, announcer, jsonMapper);
    serverAnnouncer.announce();
    segmentAnnouncer = new BatchDataSegmentAnnouncer(serverMetadata, new BatchDataSegmentAnnouncerConfig() {

        @Override
        public int getSegmentsPerNode() {
            return 50;
        }
    }, zkPathsConfig, announcer, jsonMapper);
    testSegments = Sets.newConcurrentHashSet();
    for (int i = 0; i < INITIAL_SEGMENTS; i++) {
        testSegments.add(makeSegment(i));
    }
    batchServerInventoryView = new BatchServerInventoryView(new ZkPathsConfig() {

        @Override
        public String getBase() {
            return TEST_BASE_PATH;
        }
    }, cf, jsonMapper, Predicates.alwaysTrue(), "test");
    batchServerInventoryView.start();
    inventoryUpdateCounter.set(0);
    filteredBatchServerInventoryView = new BatchServerInventoryView(new ZkPathsConfig() {

        @Override
        public String getBase() {
            return TEST_BASE_PATH;
        }
    }, cf, jsonMapper, new Predicate<Pair<DruidServerMetadata, DataSegment>>() {

        @Override
        public boolean apply(@Nullable Pair<DruidServerMetadata, DataSegment> input) {
            return input.rhs.getInterval().getStart().isBefore(SEGMENT_INTERVAL_START.plusDays(INITIAL_SEGMENTS));
        }
    }, "test") {

        @Override
        protected DruidServer addInnerInventory(DruidServer container, String inventoryKey, Set<DataSegment> inventory) {
            DruidServer server = super.addInnerInventory(container, inventoryKey, inventory);
            inventoryUpdateCounter.incrementAndGet();
            return server;
        }
    };
    filteredBatchServerInventoryView.start();
}
Also used : BatchServerInventoryView(org.apache.druid.client.BatchServerInventoryView) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) BatchDataSegmentAnnouncerConfig(org.apache.druid.server.initialization.BatchDataSegmentAnnouncerConfig) DruidServer(org.apache.druid.client.DruidServer) DruidServerMetadata(org.apache.druid.server.coordination.DruidServerMetadata) PotentiallyGzippedCompressionProvider(org.apache.druid.curator.PotentiallyGzippedCompressionProvider) DataSegment(org.apache.druid.timeline.DataSegment) CuratorDataSegmentServerAnnouncer(org.apache.druid.server.coordination.CuratorDataSegmentServerAnnouncer) Predicate(com.google.common.base.Predicate) TestingCluster(org.apache.curator.test.TestingCluster) Announcer(org.apache.druid.curator.announcement.Announcer) CuratorDataSegmentServerAnnouncer(org.apache.druid.server.coordination.CuratorDataSegmentServerAnnouncer) DataSegmentServerAnnouncer(org.apache.druid.server.coordination.DataSegmentServerAnnouncer) BatchDataSegmentAnnouncer(org.apache.druid.server.coordination.BatchDataSegmentAnnouncer) ZkPathsConfig(org.apache.druid.server.initialization.ZkPathsConfig) BatchDataSegmentAnnouncer(org.apache.druid.server.coordination.BatchDataSegmentAnnouncer) Nullable(javax.annotation.Nullable) Pair(org.apache.druid.java.util.common.Pair) Before(org.junit.Before)

Example 2 with PotentiallyGzippedCompressionProvider

use of org.apache.druid.curator.PotentiallyGzippedCompressionProvider in project druid by druid-io.

the class RemoteTaskRunnerTestUtils method setUp.

void setUp() throws Exception {
    testingCluster = new TestingCluster(1);
    testingCluster.start();
    cf = CuratorFrameworkFactory.builder().connectString(testingCluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1, 10)).compressionProvider(new PotentiallyGzippedCompressionProvider(false)).build();
    cf.start();
    cf.blockUntilConnected();
    cf.create().creatingParentsIfNeeded().forPath(BASE_PATH);
    cf.create().creatingParentsIfNeeded().forPath(TASKS_PATH);
}
Also used : TestingCluster(org.apache.curator.test.TestingCluster) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) PotentiallyGzippedCompressionProvider(org.apache.druid.curator.PotentiallyGzippedCompressionProvider)

Example 3 with PotentiallyGzippedCompressionProvider

use of org.apache.druid.curator.PotentiallyGzippedCompressionProvider in project druid by druid-io.

the class WorkerResourceTest method setUp.

@Before
public void setUp() throws Exception {
    testingCluster = new TestingCluster(1);
    testingCluster.start();
    cf = CuratorFrameworkFactory.builder().connectString(testingCluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1, 10)).compressionProvider(new PotentiallyGzippedCompressionProvider(false)).build();
    cf.start();
    cf.blockUntilConnected();
    cf.create().creatingParentsIfNeeded().forPath(BASE_PATH);
    worker = new Worker("http", "host", "ip", 3, "v1", WorkerConfig.DEFAULT_CATEGORY);
    curatorCoordinator = new WorkerCuratorCoordinator(JSON_MAPPER, new IndexerZkConfig(new ZkPathsConfig() {

        @Override
        public String getBase() {
            return BASE_PATH;
        }
    }, null, null, null, null), new RemoteTaskRunnerConfig(), cf, worker);
    curatorCoordinator.start();
    workerResource = new WorkerResource(worker, () -> curatorCoordinator, null, EasyMock.createNiceMock(WorkerTaskMonitor.class), ZkEnablementConfig.ENABLED);
}
Also used : IndexerZkConfig(org.apache.druid.server.initialization.IndexerZkConfig) TestingCluster(org.apache.curator.test.TestingCluster) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) WorkerCuratorCoordinator(org.apache.druid.indexing.worker.WorkerCuratorCoordinator) ZkPathsConfig(org.apache.druid.server.initialization.ZkPathsConfig) Worker(org.apache.druid.indexing.worker.Worker) PotentiallyGzippedCompressionProvider(org.apache.druid.curator.PotentiallyGzippedCompressionProvider) RemoteTaskRunnerConfig(org.apache.druid.indexing.overlord.config.RemoteTaskRunnerConfig) Before(org.junit.Before)

Example 4 with PotentiallyGzippedCompressionProvider

use of org.apache.druid.curator.PotentiallyGzippedCompressionProvider in project druid by druid-io.

the class OverlordTest method setupServerAndCurator.

private void setupServerAndCurator() throws Exception {
    server = new TestingServer();
    timing = new Timing();
    curator = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).sessionTimeoutMs(timing.session()).connectionTimeoutMs(timing.connection()).retryPolicy(new RetryOneTime(1)).compressionProvider(new PotentiallyGzippedCompressionProvider(true)).build();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) RetryOneTime(org.apache.curator.retry.RetryOneTime) Timing(org.apache.curator.test.Timing) PotentiallyGzippedCompressionProvider(org.apache.druid.curator.PotentiallyGzippedCompressionProvider)

Example 5 with PotentiallyGzippedCompressionProvider

use of org.apache.druid.curator.PotentiallyGzippedCompressionProvider in project druid by druid-io.

the class WorkerTaskMonitorTest method setUp.

@Before
public void setUp() throws Exception {
    testingCluster = new TestingCluster(1);
    testingCluster.start();
    cf = CuratorFrameworkFactory.builder().connectString(testingCluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1, 10)).compressionProvider(new PotentiallyGzippedCompressionProvider(false)).build();
    cf.start();
    cf.blockUntilConnected();
    cf.create().creatingParentsIfNeeded().forPath(BASE_PATH);
    worker = new Worker("http", "worker", "localhost", 3, "0", WorkerConfig.DEFAULT_CATEGORY);
    workerCuratorCoordinator = new WorkerCuratorCoordinator(jsonMapper, new IndexerZkConfig(new ZkPathsConfig() {

        @Override
        public String getBase() {
            return BASE_PATH;
        }
    }, null, null, null, null), new TestRemoteTaskRunnerConfig(new Period("PT1S")), cf, worker);
    workerCuratorCoordinator.start();
    // Start a task monitor
    workerTaskMonitor = createTaskMonitor();
    TestTasks.registerSubtypes(jsonMapper);
    jsonMapper.registerSubtypes(new NamedType(TestRealtimeTask.class, "test_realtime"));
    workerTaskMonitor.start();
    task = TestTasks.immediateSuccess("test");
}
Also used : IndexerZkConfig(org.apache.druid.server.initialization.IndexerZkConfig) TestRemoteTaskRunnerConfig(org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) Period(org.joda.time.Period) PotentiallyGzippedCompressionProvider(org.apache.druid.curator.PotentiallyGzippedCompressionProvider) TestRealtimeTask(org.apache.druid.indexing.common.TestRealtimeTask) TestingCluster(org.apache.curator.test.TestingCluster) ZkPathsConfig(org.apache.druid.server.initialization.ZkPathsConfig) Before(org.junit.Before)

Aggregations

PotentiallyGzippedCompressionProvider (org.apache.druid.curator.PotentiallyGzippedCompressionProvider)6 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)5 TestingCluster (org.apache.curator.test.TestingCluster)5 ZkPathsConfig (org.apache.druid.server.initialization.ZkPathsConfig)4 Before (org.junit.Before)4 BatchDataSegmentAnnouncer (org.apache.druid.server.coordination.BatchDataSegmentAnnouncer)2 DruidServerMetadata (org.apache.druid.server.coordination.DruidServerMetadata)2 BatchDataSegmentAnnouncerConfig (org.apache.druid.server.initialization.BatchDataSegmentAnnouncerConfig)2 IndexerZkConfig (org.apache.druid.server.initialization.IndexerZkConfig)2 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)1 Predicate (com.google.common.base.Predicate)1 Nullable (javax.annotation.Nullable)1 RetryOneTime (org.apache.curator.retry.RetryOneTime)1 TestingServer (org.apache.curator.test.TestingServer)1 Timing (org.apache.curator.test.Timing)1 BatchServerInventoryView (org.apache.druid.client.BatchServerInventoryView)1 DruidServer (org.apache.druid.client.DruidServer)1 Announcer (org.apache.druid.curator.announcement.Announcer)1 TestRealtimeTask (org.apache.druid.indexing.common.TestRealtimeTask)1 TestRemoteTaskRunnerConfig (org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig)1