Search in sources :

Example 1 with SegmentLocalCacheManager

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

the class SegmentLoadDropHandlerCacheTest method setup.

@Before
public void setup() throws IOException {
    storageLoc = new TestStorageLocation(temporaryFolder);
    SegmentLoaderConfig config = new SegmentLoaderConfig().withLocations(Collections.singletonList(storageLoc.toStorageLocationConfig(MAX_SIZE, null))).withInfoDir(storageLoc.getInfoDir());
    objectMapper = TestHelper.makeJsonMapper();
    objectMapper.registerSubtypes(TestLoadSpec.class);
    objectMapper.registerSubtypes(TestSegmentizerFactory.class);
    SegmentCacheManager cacheManager = new SegmentLocalCacheManager(config, objectMapper);
    SegmentManager segmentManager = new SegmentManager(new SegmentLocalCacheLoader(cacheManager, TestIndex.INDEX_IO, objectMapper));
    segmentAnnouncer = Mockito.mock(DataSegmentAnnouncer.class);
    loadDropHandler = new SegmentLoadDropHandler(objectMapper, config, segmentAnnouncer, Mockito.mock(DataSegmentServerAnnouncer.class), segmentManager, cacheManager, new ServerTypeConfig(ServerType.HISTORICAL));
    EmittingLogger.registerEmitter(new NoopServiceEmitter());
}
Also used : SegmentCacheManager(org.apache.druid.segment.loading.SegmentCacheManager) SegmentManager(org.apache.druid.server.SegmentManager) SegmentLocalCacheManager(org.apache.druid.segment.loading.SegmentLocalCacheManager) SegmentLocalCacheLoader(org.apache.druid.segment.loading.SegmentLocalCacheLoader) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) SegmentLoaderConfig(org.apache.druid.segment.loading.SegmentLoaderConfig) ServerTypeConfig(org.apache.druid.guice.ServerTypeConfig) Before(org.junit.Before)

Example 2 with SegmentLocalCacheManager

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

the class SegmentManagerBroadcastJoinIndexedTableTest method setup.

@Before
public void setup() throws IOException {
    segmentPuller = new LocalDataSegmentPuller();
    objectMapper = new DefaultObjectMapper().registerModule(new SegmentizerModule()).registerModule(new SimpleModule().registerSubtypes(new NamedType(LocalLoadSpec.class, "local")));
    indexIO = new IndexIO(objectMapper, () -> 0);
    objectMapper.setInjectableValues(new InjectableValues.Std().addValue(LocalDataSegmentPuller.class, segmentPuller).addValue(ExprMacroTable.class.getName(), TestExprMacroTable.INSTANCE).addValue(ObjectMapper.class.getName(), objectMapper).addValue(IndexIO.class, indexIO));
    segmentCacheDir = temporaryFolder.newFolder();
    segmentDeepStorageDir = temporaryFolder.newFolder();
    segmentCacheManager = new SegmentLocalCacheManager(new SegmentLoaderConfig() {

        @Override
        public List<StorageLocationConfig> getLocations() {
            return Collections.singletonList(new StorageLocationConfig(segmentCacheDir, null, null));
        }
    }, objectMapper);
    segmentManager = new SegmentManager(new SegmentLocalCacheLoader(segmentCacheManager, indexIO, objectMapper));
    joinableFactory = new BroadcastTableJoinableFactory(segmentManager);
    EmittingLogger.registerEmitter(new NoopServiceEmitter());
}
Also used : LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) BroadcastTableJoinableFactory(org.apache.druid.segment.join.BroadcastTableJoinableFactory) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) IndexIO(org.apache.druid.segment.IndexIO) LocalDataSegmentPuller(org.apache.druid.segment.loading.LocalDataSegmentPuller) SegmentLocalCacheManager(org.apache.druid.segment.loading.SegmentLocalCacheManager) SegmentizerModule(org.apache.druid.jackson.SegmentizerModule) SegmentLocalCacheLoader(org.apache.druid.segment.loading.SegmentLocalCacheLoader) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) SegmentLoaderConfig(org.apache.druid.segment.loading.SegmentLoaderConfig) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Before(org.junit.Before)

Example 3 with SegmentLocalCacheManager

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

the class SegmentManagerThreadSafetyTest method setup.

@Before
public void setup() throws IOException {
    segmentPuller = new TestSegmentPuller();
    objectMapper = new DefaultObjectMapper().registerModule(new SimpleModule().registerSubtypes(new NamedType(LocalLoadSpec.class, "local"), new NamedType(TestSegmentizerFactory.class, "test"))).setInjectableValues(new Std().addValue(LocalDataSegmentPuller.class, segmentPuller));
    indexIO = new IndexIO(objectMapper, () -> 0);
    segmentCacheDir = temporaryFolder.newFolder();
    segmentDeepStorageDir = temporaryFolder.newFolder();
    segmentCacheManager = new SegmentLocalCacheManager(new SegmentLoaderConfig() {

        @Override
        public List<StorageLocationConfig> getLocations() {
            return Collections.singletonList(new StorageLocationConfig(segmentCacheDir, null, null));
        }
    }, objectMapper);
    segmentManager = new SegmentManager(new SegmentLocalCacheLoader(segmentCacheManager, indexIO, objectMapper));
    exec = Execs.multiThreaded(NUM_THREAD, "SegmentManagerThreadSafetyTest-%d");
    EmittingLogger.registerEmitter(new NoopServiceEmitter());
}
Also used : Std(com.fasterxml.jackson.databind.InjectableValues.Std) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) IndexIO(org.apache.druid.segment.IndexIO) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) SegmentLocalCacheManager(org.apache.druid.segment.loading.SegmentLocalCacheManager) SegmentLocalCacheLoader(org.apache.druid.segment.loading.SegmentLocalCacheLoader) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) SegmentLoaderConfig(org.apache.druid.segment.loading.SegmentLoaderConfig) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Before(org.junit.Before)

Example 4 with SegmentLocalCacheManager

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

the class IndexTaskTest method setup.

@Before
public void setup() throws IOException {
    appenderatorsManager = new TestAppenderatorsManager();
    final File cacheDir = temporaryFolder.newFolder();
    segmentCacheManager = new SegmentLocalCacheManager(new SegmentLoaderConfig() {

        @Override
        public List<StorageLocationConfig> getLocations() {
            return Collections.singletonList(new StorageLocationConfig(cacheDir, null, null));
        }
    }, jsonMapper);
    taskRunner = new TestTaskRunner();
}
Also used : StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) SegmentLocalCacheManager(org.apache.druid.segment.loading.SegmentLocalCacheManager) SegmentLoaderConfig(org.apache.druid.segment.loading.SegmentLoaderConfig) File(java.io.File) Before(org.junit.Before)

Aggregations

SegmentLoaderConfig (org.apache.druid.segment.loading.SegmentLoaderConfig)4 SegmentLocalCacheManager (org.apache.druid.segment.loading.SegmentLocalCacheManager)4 Before (org.junit.Before)4 SegmentLocalCacheLoader (org.apache.druid.segment.loading.SegmentLocalCacheLoader)3 StorageLocationConfig (org.apache.druid.segment.loading.StorageLocationConfig)3 NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)3 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)2 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)2 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)2 IndexIO (org.apache.druid.segment.IndexIO)2 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)1 Std (com.fasterxml.jackson.databind.InjectableValues.Std)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 ServerTypeConfig (org.apache.druid.guice.ServerTypeConfig)1 SegmentizerModule (org.apache.druid.jackson.SegmentizerModule)1 BroadcastTableJoinableFactory (org.apache.druid.segment.join.BroadcastTableJoinableFactory)1 LocalDataSegmentPuller (org.apache.druid.segment.loading.LocalDataSegmentPuller)1 LocalLoadSpec (org.apache.druid.segment.loading.LocalLoadSpec)1 SegmentCacheManager (org.apache.druid.segment.loading.SegmentCacheManager)1