Search in sources :

Example 1 with TestDerbyConnector

use of org.apache.druid.metadata.TestDerbyConnector in project druid by druid-io.

the class TaskActionTestKit method before.

@Override
public void before() {
    taskStorage = new HeapMemoryTaskStorage(new TaskStorageConfig(new Period("PT24H")));
    testDerbyConnector = new TestDerbyConnector(Suppliers.ofInstance(new MetadataStorageConnectorConfig()), Suppliers.ofInstance(metadataStorageTablesConfig));
    final ObjectMapper objectMapper = new TestUtils().getTestObjectMapper();
    metadataStorageCoordinator = new IndexerSQLMetadataStorageCoordinator(objectMapper, metadataStorageTablesConfig, testDerbyConnector) {

        @Override
        public int getSqlMetadataMaxRetry() {
            return 2;
        }
    };
    taskLockbox = new TaskLockbox(taskStorage, metadataStorageCoordinator);
    segmentsMetadataManager = new SqlSegmentsMetadataManager(objectMapper, Suppliers.ofInstance(new SegmentsMetadataManagerConfig()), Suppliers.ofInstance(metadataStorageTablesConfig), testDerbyConnector);
    taskActionToolbox = new TaskActionToolbox(taskLockbox, taskStorage, metadataStorageCoordinator, new NoopServiceEmitter(), EasyMock.createMock(SupervisorManager.class));
    testDerbyConnector.createDataSourceTable();
    testDerbyConnector.createPendingSegmentsTable();
    testDerbyConnector.createSegmentTable();
    testDerbyConnector.createRulesTable();
    testDerbyConnector.createConfigTable();
    testDerbyConnector.createTaskTables();
    testDerbyConnector.createAuditTable();
}
Also used : IndexerSQLMetadataStorageCoordinator(org.apache.druid.metadata.IndexerSQLMetadataStorageCoordinator) MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) TaskStorageConfig(org.apache.druid.indexing.common.config.TaskStorageConfig) HeapMemoryTaskStorage(org.apache.druid.indexing.overlord.HeapMemoryTaskStorage) Period(org.joda.time.Period) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) TestUtils(org.apache.druid.indexing.common.TestUtils) SegmentsMetadataManagerConfig(org.apache.druid.metadata.SegmentsMetadataManagerConfig) TaskLockbox(org.apache.druid.indexing.overlord.TaskLockbox) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SqlSegmentsMetadataManager(org.apache.druid.metadata.SqlSegmentsMetadataManager)

Example 2 with TestDerbyConnector

use of org.apache.druid.metadata.TestDerbyConnector in project druid by druid-io.

the class AppenderatorDriverRealtimeIndexTaskTest method setUp.

@Before
public void setUp() throws IOException {
    EmittingLogger.registerEmitter(EMITTER);
    EMITTER.start();
    taskExec = MoreExecutors.listeningDecorator(Execs.singleThreaded("realtime-index-task-test-%d"));
    now = DateTimes.nowUtc();
    TestDerbyConnector derbyConnector = derbyConnectorRule.getConnector();
    derbyConnector.createDataSourceTable();
    derbyConnector.createTaskTables();
    derbyConnector.createSegmentTable();
    derbyConnector.createPendingSegmentsTable();
    baseDir = tempFolder.newFolder();
    reportsFile = File.createTempFile("KafkaIndexTaskTestReports-" + System.currentTimeMillis(), "json");
    makeToolboxFactory(baseDir);
}
Also used : TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) Before(org.junit.Before)

Example 3 with TestDerbyConnector

use of org.apache.druid.metadata.TestDerbyConnector in project druid by druid-io.

the class TaskLifecycleTest method setUpTaskStorage.

private TaskStorage setUpTaskStorage() {
    Preconditions.checkNotNull(mapper);
    Preconditions.checkNotNull(derbyConnectorRule);
    TaskStorage taskStorage;
    switch(taskStorageType) {
        case HEAP_TASK_STORAGE:
            {
                taskStorage = new HeapMemoryTaskStorage(new TaskStorageConfig(null) {
                });
                break;
            }
        case METADATA_TASK_STORAGE:
            {
                TestDerbyConnector testDerbyConnector = derbyConnectorRule.getConnector();
                mapper.registerSubtypes(new NamedType(MockFirehoseFactory.class, "mockFirehoseFactory"), new NamedType(MockInputSource.class, "mockInputSource"), new NamedType(NoopInputFormat.class, "noopInputFormat"));
                testDerbyConnector.createTaskTables();
                testDerbyConnector.createSegmentTable();
                taskStorage = new MetadataTaskStorage(testDerbyConnector, new TaskStorageConfig(null), new DerbyMetadataStorageActionHandlerFactory(testDerbyConnector, derbyConnectorRule.metadataTablesConfigSupplier().get(), mapper));
                break;
            }
        default:
            {
                throw new RE("Unknown task storage type [%s]", taskStorageType);
            }
    }
    tsqa = new TaskStorageQueryAdapter(taskStorage, taskLockbox);
    return taskStorage;
}
Also used : DerbyMetadataStorageActionHandlerFactory(org.apache.druid.metadata.DerbyMetadataStorageActionHandlerFactory) RE(org.apache.druid.java.util.common.RE) TaskStorageConfig(org.apache.druid.indexing.common.config.TaskStorageConfig) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector)

Example 4 with TestDerbyConnector

use of org.apache.druid.metadata.TestDerbyConnector in project druid by druid-io.

the class TaskLockboxTest method setup.

@Before
public void setup() {
    objectMapper = TestHelper.makeJsonMapper();
    objectMapper.registerSubtypes(NumberedShardSpec.class, HashBasedNumberedShardSpec.class);
    final TestDerbyConnector derbyConnector = derby.getConnector();
    derbyConnector.createTaskTables();
    derbyConnector.createPendingSegmentsTable();
    derbyConnector.createSegmentTable();
    final MetadataStorageTablesConfig tablesConfig = derby.metadataTablesConfigSupplier().get();
    taskStorage = new MetadataTaskStorage(derbyConnector, new TaskStorageConfig(null), new DerbyMetadataStorageActionHandlerFactory(derbyConnector, tablesConfig, objectMapper));
    ServiceEmitter emitter = EasyMock.createMock(ServiceEmitter.class);
    EmittingLogger.registerEmitter(emitter);
    EasyMock.replay(emitter);
    metadataStorageCoordinator = new IndexerSQLMetadataStorageCoordinator(objectMapper, tablesConfig, derbyConnector);
    lockbox = new TaskLockbox(taskStorage, metadataStorageCoordinator);
}
Also used : ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) IndexerSQLMetadataStorageCoordinator(org.apache.druid.metadata.IndexerSQLMetadataStorageCoordinator) DerbyMetadataStorageActionHandlerFactory(org.apache.druid.metadata.DerbyMetadataStorageActionHandlerFactory) MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) TaskStorageConfig(org.apache.druid.indexing.common.config.TaskStorageConfig) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) Before(org.junit.Before)

Example 5 with TestDerbyConnector

use of org.apache.druid.metadata.TestDerbyConnector in project druid by druid-io.

the class DatasourceOptimizerTest method setUp.

@Before
public void setUp() throws Exception {
    TestDerbyConnector derbyConnector = derbyConnectorRule.getConnector();
    derbyConnector.createDataSourceTable();
    derbyConnector.createSegmentTable();
    MaterializedViewConfig viewConfig = new MaterializedViewConfig();
    jsonMapper = TestHelper.makeJsonMapper();
    jsonMapper.registerSubtypes(new NamedType(DerivativeDataSourceMetadata.class, "view"));
    metadataStorageCoordinator = EasyMock.createMock(IndexerSQLMetadataStorageCoordinator.class);
    derivativesManager = new DerivativeDataSourceManager(viewConfig, derbyConnectorRule.metadataTablesConfigSupplier(), jsonMapper, derbyConnector);
    metadataStorageCoordinator = new IndexerSQLMetadataStorageCoordinator(jsonMapper, derbyConnectorRule.metadataTablesConfigSupplier().get(), derbyConnector);
    setupServerAndCurator();
    curator.start();
    curator.blockUntilConnected();
    zkPathsConfig = new ZkPathsConfig();
    setupViews();
    druidServer = new DruidServer("localhost:1234", "localhost:1234", null, 10000000L, ServerType.HISTORICAL, "default_tier", 0);
    setupZNodeForServer(druidServer, new ZkPathsConfig(), jsonMapper);
    optimizer = new DataSourceOptimizer(brokerServerView);
}
Also used : IndexerSQLMetadataStorageCoordinator(org.apache.druid.metadata.IndexerSQLMetadataStorageCoordinator) DerivativeDataSourceMetadata(org.apache.druid.indexing.materializedview.DerivativeDataSourceMetadata) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) ZkPathsConfig(org.apache.druid.server.initialization.ZkPathsConfig) DruidServer(org.apache.druid.client.DruidServer) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) Before(org.junit.Before)

Aggregations

TestDerbyConnector (org.apache.druid.metadata.TestDerbyConnector)14 Before (org.junit.Before)11 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 IndexerSQLMetadataStorageCoordinator (org.apache.druid.metadata.IndexerSQLMetadataStorageCoordinator)8 TaskStorageConfig (org.apache.druid.indexing.common.config.TaskStorageConfig)7 DerbyMetadataStorageActionHandlerFactory (org.apache.druid.metadata.DerbyMetadataStorageActionHandlerFactory)6 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)4 SmileFactory (com.fasterxml.jackson.dataformat.smile.SmileFactory)4 MetadataStorageTablesConfig (org.apache.druid.metadata.MetadataStorageTablesConfig)4 BasicAuthCommonCacheConfig (org.apache.druid.security.basic.BasicAuthCommonCacheConfig)4 JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)2 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 Module (com.fasterxml.jackson.databind.Module)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 AsyncFunction (com.google.common.util.concurrent.AsyncFunction)2 Futures (com.google.common.util.concurrent.Futures)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2