Search in sources :

Example 6 with StorageLocationConfig

use of org.apache.druid.segment.loading.StorageLocationConfig in project druid by druid-io.

the class LocalIntermediaryDataManagerAutoCleanupTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig() {

        @Override
        public long getIntermediaryPartitionDiscoveryPeriodSec() {
            return 1;
        }

        @Override
        public long getIntermediaryPartitionCleanupPeriodSec() {
            return 2;
        }

        @Override
        public Period getIntermediaryPartitionTimeout() {
            return new Period("PT2S");
        }
    };
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(tempDir.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient() {

        @Override
        public Map<String, TaskStatus> getTaskStatuses(Set<String> taskIds) {
            final Map<String, TaskStatus> result = new HashMap<>();
            for (String taskId : taskIds) {
                result.put(taskId, new TaskStatus(taskId, TaskState.SUCCESS, 10));
            }
            return result;
        }
    };
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    intermediaryDataManager.start();
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Set(java.util.Set) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) HashMap(java.util.HashMap) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) Period(org.joda.time.Period) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) TaskStatus(org.apache.druid.client.indexing.TaskStatus) Before(org.junit.Before)

Example 7 with StorageLocationConfig

use of org.apache.druid.segment.loading.StorageLocationConfig in project druid by druid-io.

the class ShuffleDataSegmentPusherTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig();
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient();
    if (LOCAL.equals(intermediateDataStore)) {
        intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    } else if (DEEPSTORE.equals(intermediateDataStore)) {
        localDeepStore = temporaryFolder.newFolder("localStorage");
        intermediaryDataManager = new DeepStorageIntermediaryDataManager(new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig() {

            @Override
            public File getStorageDirectory() {
                return localDeepStore;
            }
        }));
    }
    intermediaryDataManager.start();
    segmentPusher = new ShuffleDataSegmentPusher("supervisorTaskId", "subTaskId", intermediaryDataManager);
    final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> binder.bind(LocalDataSegmentPuller.class)));
    mapper = new DefaultObjectMapper();
    mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
    mapper.setInjectableValues(new GuiceInjectableValues(injector));
    final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
    mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
Also used : Arrays(java.util.Arrays) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) Intervals(org.apache.druid.java.util.common.Intervals) RunWith(org.junit.runner.RunWith) CompressionUtils(org.apache.druid.utils.CompressionUtils) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) SegmentLoadingException(org.apache.druid.segment.loading.SegmentLoadingException) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Interval(org.joda.time.Interval) ImmutableList(com.google.common.collect.ImmutableList) Files(com.google.common.io.Files) LocalDataSegmentPuller(org.apache.druid.segment.loading.LocalDataSegmentPuller) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) After(org.junit.After) ByteSource(com.google.common.io.ByteSource) LoadSpec(org.apache.druid.segment.loading.LoadSpec) BucketNumberedShardSpec(org.apache.druid.timeline.partition.BucketNumberedShardSpec) Parameterized(org.junit.runners.Parameterized) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Before(org.junit.Before) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) Collection(java.util.Collection) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) IOException(java.io.IOException) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Ints(com.google.common.primitives.Ints) GuiceInjectors(org.apache.druid.guice.GuiceInjectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Injector(com.google.inject.Injector) Mockito(org.mockito.Mockito) List(java.util.List) Rule(org.junit.Rule) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) DataSegment(org.apache.druid.timeline.DataSegment) Optional(java.util.Optional) Assert(org.junit.Assert) Comparator(java.util.Comparator) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) TemporaryFolder(org.junit.rules.TemporaryFolder) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Injector(com.google.inject.Injector) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) Before(org.junit.Before)

Example 8 with StorageLocationConfig

use of org.apache.druid.segment.loading.StorageLocationConfig in project druid by druid-io.

the class ShuffleResourceTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig() {

        @Override
        public long getIntermediaryPartitionDiscoveryPeriodSec() {
            return 1;
        }

        @Override
        public long getIntermediaryPartitionCleanupPeriodSec() {
            return 2;
        }

        @Override
        public Period getIntermediaryPartitionTimeout() {
            return new Period("PT2S");
        }
    };
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(tempDir.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient() {

        @Override
        public Map<String, TaskStatus> getTaskStatuses(Set<String> taskIds) {
            final Map<String, TaskStatus> result = new HashMap<>();
            for (String taskId : taskIds) {
                result.put(taskId, new TaskStatus(taskId, TaskState.SUCCESS, 10));
            }
            return result;
        }
    };
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    shuffleMetrics = new ShuffleMetrics();
    shuffleResource = new ShuffleResource(intermediaryDataManager, Optional.of(shuffleMetrics));
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Set(java.util.Set) HashMap(java.util.HashMap) Period(org.joda.time.Period) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) TaskStatus(org.apache.druid.client.indexing.TaskStatus) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) PerDatasourceShuffleMetrics(org.apache.druid.indexing.worker.shuffle.ShuffleMetrics.PerDatasourceShuffleMetrics) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) Before(org.junit.Before)

Example 9 with StorageLocationConfig

use of org.apache.druid.segment.loading.StorageLocationConfig in project druid by druid-io.

the class LocalIntermediaryDataManagerManualAddAndDeleteTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig();
    intermediarySegmentsLocation = tempDir.newFolder();
    siblingLocation = tempDir.newFolder();
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(intermediarySegmentsLocation, 1200L, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient();
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    intermediaryDataManager.start();
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) Before(org.junit.Before)

Example 10 with StorageLocationConfig

use of org.apache.druid.segment.loading.StorageLocationConfig in project druid by druid-io.

the class DruidServerConfigTest method testServerMaxSizePrecedence.

@Test
public void testServerMaxSizePrecedence() throws Exception {
    String serverConfigWithDefaultSizeStr = "{\"maxSize\":0,\"tier\":\"_default_tier\",\"priority\":0," + "\"hiddenProperties\":[\"druid.metadata.storage.connector.password\"," + "\"druid.s3.accessKey\",\"druid.s3.secretKey\"]}\n";
    String serverConfigWithNonDefaultSizeStr = "{\"maxSize\":123456,\"tier\":\"_default_tier\",\"priority\":0," + "\"hiddenProperties\":[\"druid.metadata.storage.connector.password\"," + "\"druid.s3.accessKey\",\"druid.s3.secretKey\"]}\n";
    final List<StorageLocationConfig> locations = new ArrayList<>();
    final StorageLocationConfig locationConfig1 = new StorageLocationConfig(testSegmentCacheDir1, 10000000000L, null);
    locations.add(locationConfig1);
    mapper.setInjectableValues(new InjectableValues.Std().addValue(ObjectMapper.class, new DefaultObjectMapper()).addValue(SegmentLoaderConfig.class, new SegmentLoaderConfig().withLocations(locations)));
    DruidServerConfig serverConfigWithDefaultSize = mapper.readValue(mapper.writeValueAsString(mapper.readValue(serverConfigWithDefaultSizeStr, DruidServerConfig.class)), DruidServerConfig.class);
    DruidServerConfig serverConfigWithNonDefaultSize = mapper.readValue(mapper.writeValueAsString(mapper.readValue(serverConfigWithNonDefaultSizeStr, DruidServerConfig.class)), DruidServerConfig.class);
    Assert.assertEquals(serverConfigWithDefaultSize.getMaxSize(), 10000000000L);
    Assert.assertEquals(serverConfigWithNonDefaultSize.getMaxSize(), 123456L);
}
Also used : StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) ArrayList(java.util.ArrayList) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) SegmentLoaderConfig(org.apache.druid.segment.loading.SegmentLoaderConfig) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) Test(org.junit.Test)

Aggregations

StorageLocationConfig (org.apache.druid.segment.loading.StorageLocationConfig)10 Before (org.junit.Before)8 TaskConfig (org.apache.druid.indexing.common.config.TaskConfig)5 WorkerConfig (org.apache.druid.indexing.worker.config.WorkerConfig)5 IndexingServiceClient (org.apache.druid.client.indexing.IndexingServiceClient)4 NoopIndexingServiceClient (org.apache.druid.client.indexing.NoopIndexingServiceClient)4 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)4 SegmentLoaderConfig (org.apache.druid.segment.loading.SegmentLoaderConfig)4 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)3 SegmentLocalCacheManager (org.apache.druid.segment.loading.SegmentLocalCacheManager)3 Test (org.junit.Test)3 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Set (java.util.Set)2 TaskStatus (org.apache.druid.client.indexing.TaskStatus)2 IndexIO (org.apache.druid.segment.IndexIO)2