public TableConfig() { // TODO: currently these 2 fields are annotated as non-null. Revisit to see whether that's necessary _tenantConfig = new TenantConfig(); _customConfig = new TableCustomConfig(); }
public TagConfig(TableConfig tableConfig) { _tableConfig = tableConfig; _serverTenant = tableConfig.getTenantConfig().getServer(); }
@Override public String unparse(Duration value) { if (value != null) { return value.getUnitCount() + " " + value.getUnit(); } else { return null; } } }
private void validateLoadedConfig(TableConfig config) { Assert.assertEquals(config.getTableName(), "mytable_OFFLINE"); Assert.assertEquals(config.getQuotaConfig().getStorage(), "125 GiB"); Assert.assertEquals(config.getValidationConfig().getRetentionTimeValue(), "5"); Assert.assertEquals(config.getValidationConfig().getRetentionTimeUnit(), "DAYS"); Assert.assertEquals(config.getTenantConfig().getBroker(), "foo"); Assert.assertEquals(config.getTenantConfig().getServer(), "bar"); Assert.assertEquals(config.getIndexingConfig().getSortedColumn(), Lists.newArrayList("foo")); } }
private TableConfig buildOfflineTableConfig() throws Exception { // Create the replica group aware assignment strategy config ReplicaGroupStrategyConfig replicaGroupStrategyConfig = new ReplicaGroupStrategyConfig(); replicaGroupStrategyConfig.setNumInstancesPerPartition(NUM_PARTITION); replicaGroupStrategyConfig.setMirrorAssignmentAcrossReplicaGroups(true); // Create the routing config RoutingConfig routingConfig = new RoutingConfig(); routingConfig.setRoutingTableBuilderName("PartitionAwareOffline"); // Create table config TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(OFFLINE_TABLE_NAME) .setNumReplicas(NUM_REPLICA).setSegmentAssignmentStrategy("ReplicaGroupSegmentAssignmentStrategy").build(); tableConfig.getValidationConfig().setReplicaGroupStrategyConfig(replicaGroupStrategyConfig); tableConfig.setRoutingConfig(routingConfig); return tableConfig; }
private void addingTableToPropertyStore(String tableName) throws Exception { TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(tableName) .setTimeColumnName("timestamp").setTimeType("DAYS").build(); ZKMetadataProvider .setOfflineTableConfig(_propertyStore, tableConfig.getTableName(), TableConfig.toZnRecord(tableConfig)); } }
private TableConfig generateTableConfig(String tableName) throws Exception { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); Builder builder = new TableConfig.Builder(tableType); builder.setTableName(tableName); return builder.build(); } }
private void checkTableConfigWithAssignmentConfig(TableConfig tableConfig, TableConfig tableConfigToCompare) { // Check that the segment assignment configuration does exist. Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName()); Assert.assertNotNull(tableConfigToCompare.getValidationConfig().getReplicaGroupStrategyConfig()); Assert.assertEquals(tableConfigToCompare.getValidationConfig().getReplicaGroupStrategyConfig(), tableConfig.getValidationConfig().getReplicaGroupStrategyConfig()); // Check that the configurations are correct. ReplicaGroupStrategyConfig strategyConfig = tableConfigToCompare.getValidationConfig().getReplicaGroupStrategyConfig(); Assert.assertTrue(strategyConfig.getMirrorAssignmentAcrossReplicaGroups()); Assert.assertEquals(strategyConfig.getNumInstancesPerPartition(), 5); Assert.assertEquals(strategyConfig.getPartitionColumn(), "memberId"); }
public static TableConfig getDynamicComputingTableConfig(String tableName) { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); RoutingConfig routingConfig = new RoutingConfig(); Map<String, String> routingTableBuilderOptions = new HashMap<>(); routingTableBuilderOptions.put(RoutingConfig.ENABLE_DYNAMIC_COMPUTING_KEY, "true"); routingConfig.setRoutingTableBuilderOptions(routingTableBuilderOptions); return new TableConfig.Builder(tableType).setTableName(tableName).setRoutingConfig(routingConfig).build(); } }
private void updateTableConfig(int targetNumInstancePerPartition, int targetNumReplicaGroup) throws IOException { String tableNameWithType = TableNameBuilder.OFFLINE.tableNameWithType(TABLE_NAME); TableConfig tableConfig = _helixResourceManager.getTableConfig(TABLE_NAME, CommonConstants.Helix.TableType.OFFLINE); tableConfig.getValidationConfig().getReplicaGroupStrategyConfig() .setNumInstancesPerPartition(targetNumInstancePerPartition); tableConfig.getValidationConfig().setReplication(Integer.toString(targetNumReplicaGroup)); _helixResourceManager .setExistingTableConfig(tableConfig, tableNameWithType, CommonConstants.Helix.TableType.OFFLINE); } }
private TableConfig createOfflineTableConfig() throws Exception { return new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(TEST_TABLE_NAME) .setRetentionTimeUnit("DAYS").setRetentionTimeValue("365").setNumReplicas(2).build(); }
@Override public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore, BrokerMetrics brokerMetrics) { super.init(configuration, tableConfig, propertyStore, brokerMetrics); String partitionColumn = tableConfig.getValidationConfig().getReplicaGroupStrategyConfig().getPartitionColumn(); _isPartitionLevelReplicaGroupAssignment = (partitionColumn != null); _numReplicas = tableConfig.getValidationConfig().getReplicationNumber(); }
@Override public void init(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { _tableNameWithType = tableConfig.getTableName(); _propertyStore = propertyStore; }
private void setQps(TableConfig tableConfig) { QuotaConfig quotaConfig = new QuotaConfig(); quotaConfig.setMaxQueriesPerSecond("100.00"); tableConfig.setQuotaConfig(quotaConfig); }
public static String getTagFromTenantAndServerType(String tenantName, ServerType type) { if (type == ServerType.OFFLINE) { return getOfflineTagForTenant(tenantName); } return getRealtimeTagForTenant(tenantName); }
public TenantBuilder(String name) { tenant = new Tenant(); tenant.setTenantName(name); }
/** * Returns the number of partitions for the specified column. * If segment partition config does not exist, returns {@link SegmentPartitionConfig#INVALID_NUM_PARTITIONS}. * * @param column Column for which to to return the number of partitions. * @return Number of partitions for the column. */ public int getNumPartitions(String column) { return (_segmentPartitionConfig != null) ? _segmentPartitionConfig.getNumPartitions(column) : SegmentPartitionConfig.INVALID_NUM_PARTITIONS; }
public Tenant build() { tenant.isCoLocated(); return tenant; } }
private TableConfig generateTableConfig(String tableName) { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); Builder builder = new TableConfig.Builder(tableType); builder.setTableName(tableName); return builder.build(); } }
private TableConfig generateDefaultTableConfig(String tableName) { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); TableConfig.Builder builder = new TableConfig.Builder(tableType); builder.setTableName(tableName); return builder.build(); }