Search in sources :

Example 1 with TableDataManagerConfig

use of com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig in project pinot by linkedin.

the class OfflineTableDataManagerTest method makeTestableManager.

private OfflineTableDataManager makeTestableManager() throws Exception {
    OfflineTableDataManager tableDataManager = new OfflineTableDataManager();
    TableDataManagerConfig config;
    {
        config = mock(TableDataManagerConfig.class);
        when(config.getTableName()).thenReturn(tableName);
        when(config.getDataDir()).thenReturn(_tmpDir.getAbsolutePath());
        when(config.getReadMode()).thenReturn(readMode.toString());
        when(config.getIndexLoadingConfigMetadata()).thenReturn(null);
    }
    tableDataManager.init(config, new ServerMetrics(new MetricsRegistry()), null);
    tableDataManager.start();
    Field segsMapField = AbstractTableDataManager.class.getDeclaredField("_segmentsMap");
    segsMapField.setAccessible(true);
    _internalSegMap = (Map<String, OfflineSegmentDataManager>) segsMapField.get(tableDataManager);
    return tableDataManager;
}
Also used : Field(java.lang.reflect.Field) MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) OfflineSegmentDataManager(com.linkedin.pinot.core.data.manager.offline.OfflineSegmentDataManager) TableDataManagerConfig(com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig) OfflineTableDataManager(com.linkedin.pinot.core.data.manager.offline.OfflineTableDataManager) ServerMetrics(com.linkedin.pinot.common.metrics.ServerMetrics)

Example 2 with TableDataManagerConfig

use of com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig in project pinot by linkedin.

the class FileBasedInstanceDataManager method init.

@Override
public synchronized void init(Configuration dataManagerConfig) {
    try {
        _instanceDataManagerConfig = new FileBasedInstanceDataManagerConfig(dataManagerConfig);
    } catch (Exception e) {
        _instanceDataManagerConfig = null;
        LOGGER.error("Error during InstanceDataManager initialization", e);
        Utils.rethrowException(e);
    }
    for (String tableName : _instanceDataManagerConfig.getTableNames()) {
        TableDataManagerConfig tableDataManagerConfig = _instanceDataManagerConfig.getTableDataManagerConfig(tableName);
        TableDataManager tableDataManager = TableDataManagerProvider.getTableDataManager(tableDataManagerConfig, null);
        _tableDataManagerMap.put(tableName, tableDataManager);
    }
    try {
        _segmentMetadataLoader = getSegmentMetadataLoader(_instanceDataManagerConfig.getSegmentMetadataLoaderClass());
        LOGGER.info("Loaded SegmentMetadataLoader for class name : " + _instanceDataManagerConfig.getSegmentMetadataLoaderClass());
    } catch (Exception e) {
        LOGGER.error("Cannot initialize SegmentMetadataLoader for class name : " + _instanceDataManagerConfig.getSegmentMetadataLoaderClass(), e);
        Utils.rethrowException(e);
    }
}
Also used : TableDataManagerConfig(com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig) FileBasedInstanceDataManagerConfig(com.linkedin.pinot.core.data.manager.config.FileBasedInstanceDataManagerConfig) ConfigurationException(org.apache.commons.configuration.ConfigurationException)

Example 3 with TableDataManagerConfig

use of com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig in project pinot by linkedin.

the class FileBasedInstanceDataManager method init.

public synchronized void init(FileBasedInstanceDataManagerConfig instanceDataManagerConfig) throws ConfigurationException, InstantiationException, IllegalAccessException, ClassNotFoundException {
    _instanceDataManagerConfig = instanceDataManagerConfig;
    for (String tableName : _instanceDataManagerConfig.getTableNames()) {
        TableDataManagerConfig tableDataManagerConfig = _instanceDataManagerConfig.getTableDataManagerConfig(tableName);
        TableDataManager tableDataManager = TableDataManagerProvider.getTableDataManager(tableDataManagerConfig, null);
        _tableDataManagerMap.put(tableName, tableDataManager);
    }
    _segmentMetadataLoader = getSegmentMetadataLoader(_instanceDataManagerConfig.getSegmentMetadataLoaderClass());
}
Also used : TableDataManagerConfig(com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig)

Example 4 with TableDataManagerConfig

use of com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig in project pinot by linkedin.

the class HelixInstanceDataManager method addTableIfNeed.

public synchronized void addTableIfNeed(AbstractTableConfig tableConfig, String tableName, String serverInstance) throws ConfigurationException {
    TableDataManagerConfig tableDataManagerConfig = getDefaultHelixTableDataManagerConfig(tableName);
    if (tableConfig != null) {
        tableDataManagerConfig.overrideConfigs(tableName, tableConfig);
    }
    TableDataManager tableDataManager = TableDataManagerProvider.getTableDataManager(tableDataManagerConfig, serverInstance);
    tableDataManager.start();
    addTableDataManager(tableName, tableDataManager);
}
Also used : TableDataManager(com.linkedin.pinot.core.data.manager.offline.TableDataManager) TableDataManagerConfig(com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig)

Example 5 with TableDataManagerConfig

use of com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig in project pinot by linkedin.

the class ResourceTestHelper method addTable.

public void addTable(String tableName) throws IOException, ConfigurationException {
    File directory = new File(INDEX_DIR, tableName);
    FileUtils.forceMkdir(directory);
    PropertiesConfiguration tableConfig = new PropertiesConfiguration();
    tableConfig.setProperty("directory", tableName);
    tableConfig.setProperty("name", tableName);
    tableConfig.setProperty("dataManagerType", "offline");
    tableConfig.setProperty("readMode", "heap");
    FileBasedInstanceDataManager dataManager = (FileBasedInstanceDataManager) serverInstance.getInstanceDataManager();
    dataManager.addTable(new TableDataManagerConfig(tableConfig));
}
Also used : FileBasedInstanceDataManager(com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager) TableDataManagerConfig(com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Aggregations

TableDataManagerConfig (com.linkedin.pinot.core.data.manager.config.TableDataManagerConfig)6 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)2 ServerMetrics (com.linkedin.pinot.common.metrics.ServerMetrics)1 FileBasedInstanceDataManagerConfig (com.linkedin.pinot.core.data.manager.config.FileBasedInstanceDataManagerConfig)1 FileBasedInstanceDataManager (com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager)1 OfflineSegmentDataManager (com.linkedin.pinot.core.data.manager.offline.OfflineSegmentDataManager)1 OfflineTableDataManager (com.linkedin.pinot.core.data.manager.offline.OfflineTableDataManager)1 TableDataManager (com.linkedin.pinot.core.data.manager.offline.TableDataManager)1 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)1 File (java.io.File)1 Field (java.lang.reflect.Field)1 Configuration (org.apache.commons.configuration.Configuration)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1