Search in sources :

Example 1 with RealtimeTableConfig

use of com.linkedin.pinot.common.config.RealtimeTableConfig in project pinot by linkedin.

the class TableConfigRoutingTableSelector method getLlcRatio.

private float getLlcRatio(String realtimeTableName) {
    RealtimeTableConfig tableConfig = (RealtimeTableConfig) ZKMetadataProvider.getRealtimeTableConfig(_propertyStore, realtimeTableName);
    if (tableConfig == null) {
        LOGGER.warn("Failed to fetch table config for table {}", realtimeTableName);
        return 0.0f;
    }
    Map<String, String> customConfigs = tableConfig.getCustomConfigs().getCustomConfigs();
    if (customConfigs.containsKey(LLC_ROUTING_PERCENTAGE_CONFIG_KEY)) {
        String routingPercentageString = customConfigs.get(LLC_ROUTING_PERCENTAGE_CONFIG_KEY);
        float routingPercentage;
        try {
            routingPercentage = Float.parseFloat(routingPercentageString);
        } catch (NumberFormatException e) {
            LOGGER.warn("Couldn't parse {} as a valid LLC routing percentage, should be a number between 0-100", e);
            return 0.0f;
        }
        if (routingPercentage < 0.0f || 100.0f < routingPercentage) {
            routingPercentage = Math.min(Math.max(routingPercentage, 0.0f), 100.0f);
            LOGGER.warn("LLC routing percentage ({}) is outside of [0;100], percentage was clamped to {}.", routingPercentageString, routingPercentage);
        }
        return routingPercentage;
    }
    return 0.0f;
}
Also used : RealtimeTableConfig(com.linkedin.pinot.common.config.RealtimeTableConfig)

Example 2 with RealtimeTableConfig

use of com.linkedin.pinot.common.config.RealtimeTableConfig in project pinot by linkedin.

the class PinotHelixResourceManager method updateIndexingConfigFor.

public void updateIndexingConfigFor(String tableName, TableType type, IndexingConfig newConfigs) throws Exception {
    String actualTableName = new TableNameBuilder(type).forTable(tableName);
    AbstractTableConfig config;
    if (type == TableType.REALTIME) {
        config = ZKMetadataProvider.getRealtimeTableConfig(getPropertyStore(), actualTableName);
        if (config != null) {
            ((RealtimeTableConfig) config).setIndexConfig(newConfigs);
        }
    } else {
        config = ZKMetadataProvider.getOfflineTableConfig(getPropertyStore(), actualTableName);
        if (config != null) {
            ((OfflineTableConfig) config).setIndexConfig(newConfigs);
        }
    }
    if (config == null) {
        throw new RuntimeException("tableName : " + tableName + " of type : " + type + " not found");
    }
    setTableConfig(config, actualTableName, type);
    if (type == TableType.REALTIME) {
        ensureRealtimeClusterIsSetUp(config, tableName, newConfigs);
    }
}
Also used : RealtimeTableConfig(com.linkedin.pinot.common.config.RealtimeTableConfig) AbstractTableConfig(com.linkedin.pinot.common.config.AbstractTableConfig) OfflineTableConfig(com.linkedin.pinot.common.config.OfflineTableConfig) TableNameBuilder(com.linkedin.pinot.common.config.TableNameBuilder)

Aggregations

RealtimeTableConfig (com.linkedin.pinot.common.config.RealtimeTableConfig)2 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)1 OfflineTableConfig (com.linkedin.pinot.common.config.OfflineTableConfig)1 TableNameBuilder (com.linkedin.pinot.common.config.TableNameBuilder)1