This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new cf939ac0ba Use expected version in api for table config read modify
write change (#11782)
cf939ac0ba is described below
commit cf939ac0babbfcfd54514517cf9fe877006b02ff
Author: Xiang Fu <[email protected]>
AuthorDate: Sun Oct 15 10:24:43 2023 -0700
Use expected version in api for table config read modify write change
(#11782)
* Always use expected version in api for table config read modify write
change
* Adding createTableConfig and setTableConfig for ZKMetadataProvider
---
...elixExternalViewBasedQueryQuotaManagerTest.java | 31 ++++-----
.../pinot/common/metadata/ZKMetadataProvider.java | 66 +++++++++++++++++++
.../pinot/controller/BaseControllerStarter.java | 27 ++------
.../helix/core/PinotHelixResourceManager.java | 77 +++++++++++++---------
4 files changed, 128 insertions(+), 73 deletions(-)
diff --git
a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
index 64b2693767..8982998634 100644
---
a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
+++
b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
@@ -38,7 +38,6 @@ import org.apache.helix.zookeeper.impl.client.ZkClient;
import org.apache.pinot.common.metadata.ZKMetadataProvider;
import org.apache.pinot.common.metrics.BrokerMetrics;
import org.apache.pinot.common.utils.ZkStarter;
-import org.apache.pinot.common.utils.config.TableConfigUtils;
import org.apache.pinot.spi.config.table.QuotaConfig;
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.config.table.TableType;
@@ -147,7 +146,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
TableConfigUtils.toZNRecord(tableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, tableConfig);
setQps(tableConfig);
_queryQuotaManager.initOrUpdateTableQueryQuota(tableConfig,
brokerResource);
Assert.assertEquals(_queryQuotaManager.getRateLimiterMapSize(), 1);
@@ -178,8 +177,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
new
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
.setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
.setBrokerTenant("testBroker").setServerTenant("testServer").build();
- ZKMetadataProvider.setTableConfig(_testPropertyStore, REALTIME_TABLE_NAME,
- TableConfigUtils.toZNRecord(realtimeTableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, realtimeTableConfig);
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
@@ -201,8 +199,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
new
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
.setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
.setBrokerTenant("testBroker").setServerTenant("testServer").build();
- ZKMetadataProvider.setTableConfig(_testPropertyStore, REALTIME_TABLE_NAME,
- TableConfigUtils.toZNRecord(realtimeTableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, realtimeTableConfig);
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
@@ -233,10 +230,8 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
.setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
.setBrokerTenant("testBroker").setServerTenant("testServer").build();
- ZKMetadataProvider.setTableConfig(_testPropertyStore, REALTIME_TABLE_NAME,
- TableConfigUtils.toZNRecord(realtimeTableConfig));
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
- TableConfigUtils.toZNRecord(offlineTableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, realtimeTableConfig);
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, offlineTableConfig);
// Since each table has 2 online brokers, per broker rate becomes 100.0 /
2 = 50.0
_queryQuotaManager.initOrUpdateTableQueryQuota(offlineTableConfig,
brokerResource);
@@ -262,8 +257,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
throws Exception {
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
- ZKMetadataProvider.setTableConfig(_testPropertyStore, REALTIME_TABLE_NAME,
- TableConfigUtils.toZNRecord(tableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, tableConfig);
setQps(tableConfig);
_queryQuotaManager.initOrUpdateTableQueryQuota(tableConfig,
brokerResource);
Assert.assertEquals(_queryQuotaManager.getRateLimiterMapSize(), 1);
@@ -279,8 +273,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
throws Exception {
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
- ZKMetadataProvider.setTableConfig(_testPropertyStore, REALTIME_TABLE_NAME,
- TableConfigUtils.toZNRecord(tableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, tableConfig);
setQps(tableConfig);
_queryQuotaManager.initOrUpdateTableQueryQuota(tableConfig,
brokerResource);
Assert.assertEquals(_queryQuotaManager.getRateLimiterMapSize(), 1);
@@ -311,8 +304,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
new
TableConfigBuilder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
.setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
.setBrokerTenant("testBroker").setServerTenant("testServer").build();
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
- TableConfigUtils.toZNRecord(offlineTableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, offlineTableConfig);
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
@@ -330,8 +322,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
new
TableConfigBuilder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
.setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
.setBrokerTenant("testBroker").setServerTenant("testServer").build();
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
- TableConfigUtils.toZNRecord(offlineTableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, offlineTableConfig);
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
@@ -357,7 +348,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
throws Exception {
ExternalView brokerResource = new
ExternalView(CommonConstants.Helix.BROKER_RESOURCE_INSTANCE);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
TableConfigUtils.toZNRecord(tableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, tableConfig);
setQps(tableConfig);
_queryQuotaManager.initOrUpdateTableQueryQuota(tableConfig,
brokerResource);
Assert.assertEquals(_queryQuotaManager.getRateLimiterMapSize(), 1);
@@ -369,7 +360,7 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
ExternalView brokerResource = new
ExternalView(CommonConstants.Helix.BROKER_RESOURCE_INSTANCE);
brokerResource.setState(OFFLINE_TABLE_NAME, "broker_instance_2",
"OFFLINE");
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
- ZKMetadataProvider.setTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME,
TableConfigUtils.toZNRecord(tableConfig));
+ ZKMetadataProvider.setTableConfig(_testPropertyStore, tableConfig);
setQps(tableConfig);
_queryQuotaManager.initOrUpdateTableQueryQuota(tableConfig,
brokerResource);
diff --git
a/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
b/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
index fc76f96709..eba5806365 100644
---
a/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
+++
b/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.helix.AccessOption;
import org.apache.helix.store.HelixPropertyStore;
import org.apache.helix.store.zk.ZkHelixPropertyStore;
@@ -73,12 +74,61 @@ public class ZKMetadataProvider {
propertyStore.set(constructPropertyStorePathForUserConfig(username),
znRecord, AccessOption.PERSISTENT);
}
+ @Deprecated
public static void setTableConfig(ZkHelixPropertyStore<ZNRecord>
propertyStore, String tableNameWithType,
ZNRecord znRecord) {
propertyStore.set(constructPropertyStorePathForResourceConfig(tableNameWithType),
znRecord,
AccessOption.PERSISTENT);
}
+ /**
+ * Create table config, fail if existed.
+ *
+ * @return true if creation is successful.
+ */
+ public static boolean createTableConfig(ZkHelixPropertyStore<ZNRecord>
propertyStore, TableConfig tableConfig) {
+ String tableNameWithType = tableConfig.getTableName();
+ String tableConfigPath =
constructPropertyStorePathForResourceConfig(tableNameWithType);
+ ZNRecord tableConfigZNRecord;
+ try {
+ tableConfigZNRecord = TableConfigUtils.toZNRecord(tableConfig);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception constructing ZNRecord from table config
for table: {}", tableNameWithType, e);
+ return false;
+ }
+ return propertyStore.create(tableConfigPath, tableConfigZNRecord,
AccessOption.PERSISTENT);
+ }
+
+ /**
+ * Full override table config.
+ *
+ * @return true if update is successful.
+ */
+ public static boolean setTableConfig(ZkHelixPropertyStore<ZNRecord>
propertyStore, TableConfig tableConfig) {
+ return setTableConfig(propertyStore, tableConfig, -1);
+ }
+
+ /**
+ * Update table config with an expected version. This is to avoid race
condition for table config update issued by
+ * multiple clients, especially when update configs in a programmatic way.
+ * The typical usage is to read table config, apply some changes, then
update it.
+ *
+ * @return true if update is successful.
+ */
+ public static boolean setTableConfig(ZkHelixPropertyStore<ZNRecord>
propertyStore, TableConfig tableConfig,
+ int expectedVersion) {
+ String tableNameWithType = tableConfig.getTableName();
+ ZNRecord tableConfigZNRecord;
+ try {
+ tableConfigZNRecord = TableConfigUtils.toZNRecord(tableConfig);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception constructing ZNRecord from table config
for table: {}", tableNameWithType, e);
+ return false;
+ }
+ return
propertyStore.set(constructPropertyStorePathForResourceConfig(tableNameWithType),
tableConfigZNRecord,
+ expectedVersion, AccessOption.PERSISTENT);
+ }
+
@Deprecated
public static void setRealtimeTableConfig(ZkHelixPropertyStore<ZNRecord>
propertyStore, String realtimeTableName,
ZNRecord znRecord) {
@@ -317,6 +367,22 @@ public class ZKMetadataProvider {
AccessOption.PERSISTENT));
}
+ /**
+ * @return a pair of table config and current version from znRecord, null if
table config does not exist.
+ */
+ @Nullable
+ public static ImmutablePair<TableConfig, Integer> getTableConfigWithVersion(
+ ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) {
+ Stat tableConfigStat = new Stat();
+ TableConfig tableConfig = toTableConfig(
+
propertyStore.get(constructPropertyStorePathForResourceConfig(tableNameWithType),
tableConfigStat,
+ AccessOption.PERSISTENT));
+ if (tableConfig == null) {
+ return null;
+ }
+ return ImmutablePair.of(tableConfig, tableConfigStat.getVersion());
+ }
+
@Nullable
public static TableConfig
getOfflineTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String
tableName) {
return getTableConfig(propertyStore,
TableNameBuilder.OFFLINE.tableNameWithType(tableName));
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
index 3b2565f020..185b1d506e 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
@@ -38,6 +38,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.helix.AccessOption;
import org.apache.helix.HelixManager;
import org.apache.helix.HelixManagerFactory;
@@ -71,7 +72,6 @@ import org.apache.pinot.common.utils.SchemaUtils;
import org.apache.pinot.common.utils.ServiceStartableUtils;
import org.apache.pinot.common.utils.ServiceStatus;
import org.apache.pinot.common.utils.TlsUtils;
-import org.apache.pinot.common.utils.config.TableConfigUtils;
import org.apache.pinot.common.utils.fetcher.SegmentFetcherFactory;
import org.apache.pinot.common.utils.helix.HelixHelper;
import org.apache.pinot.common.utils.helix.LeadControllerUtils;
@@ -127,7 +127,6 @@ import org.apache.pinot.spi.utils.InstanceTypeUtils;
import org.apache.pinot.spi.utils.NetUtils;
import org.apache.pinot.spi.utils.builder.TableNameBuilder;
import org.apache.pinot.sql.parsers.rewriter.QueryRewriterFactory;
-import org.apache.zookeeper.data.Stat;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -580,22 +579,15 @@ public abstract class BaseControllerStarter implements
ServiceStartable {
List<String> allTables = _helixResourceManager.getAllTables();
allTables.forEach(tableNameWithType -> {
- String tableConfigPath =
ZKMetadataProvider.constructPropertyStorePathForResourceConfig(tableNameWithType);
- Stat tableConfigStat = new Stat();
- ZNRecord tableConfigZNRecord = propertyStore.get(tableConfigPath,
tableConfigStat, AccessOption.PERSISTENT);
- if (tableConfigZNRecord == null) {
+ Pair<TableConfig, Integer> tableConfigWithVersion =
+ ZKMetadataProvider.getTableConfigWithVersion(propertyStore,
tableNameWithType);
+ if (tableConfigWithVersion == null) {
// This might due to table deletion, just log it here.
LOGGER.warn("Failed to find table config for table: {}, the table
likely already got deleted",
tableNameWithType);
return;
}
- TableConfig tableConfig;
- try {
- tableConfig = TableConfigUtils.fromZNRecord(tableConfigZNRecord);
- } catch (Exception e) {
- LOGGER.error("Caught exception constructing table config from ZNRecord
for table: {}", tableNameWithType, e);
- return;
- }
+ TableConfig tableConfig = tableConfigWithVersion.getLeft();
String rawTableName =
TableNameBuilder.extractRawTableName(tableNameWithType);
String schemaPath =
ZKMetadataProvider.constructPropertyStorePathForSchema(rawTableName);
boolean schemaExists = propertyStore.exists(schemaPath,
AccessOption.PERSISTENT);
@@ -635,14 +627,7 @@ public abstract class BaseControllerStarter implements
ServiceStartable {
}
// Update table config to remove schema name
tableConfig.getValidationConfig().setSchemaName(null);
- try {
- tableConfigZNRecord = TableConfigUtils.toZNRecord(tableConfig);
- } catch (Exception e) {
- LOGGER.error("Caught exception constructing ZNRecord from table config
for table: {}", tableNameWithType, e);
- return;
- }
- if (propertyStore.set(tableConfigPath, tableConfigZNRecord,
tableConfigStat.getVersion(),
- AccessOption.PERSISTENT)) {
+ if (ZKMetadataProvider.setTableConfig(propertyStore, tableConfig,
tableConfigWithVersion.getRight())) {
LOGGER.info("Removed schema name from table config for table: {}",
tableNameWithType);
fixedSchemaTableCount.getAndIncrement();
} else {
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
index 860a9e1f83..81dec9a34e 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
@@ -57,6 +57,7 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.helix.AccessOption;
import org.apache.helix.ClusterMessagingService;
@@ -1559,33 +1560,27 @@ public class PinotHelixResourceManager {
if (ZKMetadataProvider.getSchema(_propertyStore,
TableNameBuilder.extractRawTableName(tableNameWithType)) == null) {
throw new InvalidTableConfigException("No schema defined for table: " +
tableNameWithType);
}
- if (tableType == TableType.OFFLINE) {
- try {
- // Add table config
- ZKMetadataProvider.setTableConfig(_propertyStore, tableNameWithType,
TableConfigUtils.toZNRecord(tableConfig));
- // Assign instances
- assignInstances(tableConfig, true);
+ Preconditions.checkState(tableType == TableType.OFFLINE || tableType ==
TableType.REALTIME,
+ "Invalid table type: %s", tableType);
+
+ // Add table config
+ if (!ZKMetadataProvider.createTableConfig(_propertyStore, tableConfig)) {
+ throw new RuntimeException("Failed to create table config for table: " +
tableNameWithType);
+ }
+ try {
+ // Assign instances
+ assignInstances(tableConfig, true);
+ if (tableType == TableType.OFFLINE) {
// Add ideal state
_helixAdmin.addResource(_helixClusterName, tableNameWithType,
idealState);
- } catch (Exception e) {
- LOGGER.error("Caught exception during offline table setup. Cleaning up
table {}", tableNameWithType, e);
- deleteOfflineTable(tableNameWithType);
- throw e;
- }
- } else {
- Preconditions.checkState(tableType == TableType.REALTIME, "Invalid table
type: %s", tableType);
- try {
- // Add table config
- ZKMetadataProvider.setTableConfig(_propertyStore, tableNameWithType,
TableConfigUtils.toZNRecord(tableConfig));
- // Assign instances
- assignInstances(tableConfig, true);
+ } else {
// Add ideal state with the first CONSUMING segment
_pinotLLCRealtimeSegmentManager.setUpNewTable(tableConfig, idealState);
- } catch (Exception e) {
- LOGGER.error("Caught exception during realtime table setup. Cleaning
up table {}", tableNameWithType, e);
- deleteRealtimeTable(tableNameWithType);
- throw e;
}
+ } catch (Exception e) {
+ LOGGER.error("Caught exception during offline table setup. Cleaning up
table {}", tableNameWithType, e);
+ deleteTable(tableNameWithType, tableType, null);
+ throw e;
}
LOGGER.info("Updating BrokerResource for table: {}", tableNameWithType);
@@ -1795,8 +1790,20 @@ public class PinotHelixResourceManager {
*/
public void setExistingTableConfig(TableConfig tableConfig)
throws IOException {
+ setExistingTableConfig(tableConfig, -1);
+ }
+
+ /**
+ * Sets the given table config into zookeeper with the expected version,
which is the previous tableConfig znRecord
+ * version. If the expected version is -1, the version check is ignored.
+ */
+ public void setExistingTableConfig(TableConfig tableConfig, int
expectedVersion)
+ throws IOException {
String tableNameWithType = tableConfig.getTableName();
- ZKMetadataProvider.setTableConfig(_propertyStore, tableNameWithType,
TableConfigUtils.toZNRecord(tableConfig));
+ if (!ZKMetadataProvider.setTableConfig(_propertyStore, tableConfig,
expectedVersion)) {
+ throw new RuntimeException("Failed to update table config in Zookeeper
for table: " + tableNameWithType + " with"
+ + " expected version: " + expectedVersion);
+ }
// Update IdealState replication
IdealState idealState =
_helixAdmin.getResourceIdealState(_helixClusterName, tableNameWithType);
@@ -1819,35 +1826,41 @@ public class PinotHelixResourceManager {
public void updateMetadataConfigFor(String tableName, TableType type,
TableCustomConfig newConfigs)
throws Exception {
String tableNameWithType =
TableNameBuilder.forType(type).tableNameWithType(tableName);
- TableConfig tableConfig =
ZKMetadataProvider.getTableConfig(_propertyStore, tableNameWithType);
- if (tableConfig == null) {
+ ImmutablePair<TableConfig, Integer> tableConfigWithVersion =
+ ZKMetadataProvider.getTableConfigWithVersion(_propertyStore,
tableNameWithType);
+ if (tableConfigWithVersion == null) {
throw new RuntimeException("Table: " + tableName + " of type: " + type +
" does not exist");
}
+ TableConfig tableConfig = tableConfigWithVersion.getLeft();
tableConfig.setCustomConfig(newConfigs);
- setExistingTableConfig(tableConfig);
+ setExistingTableConfig(tableConfig, tableConfigWithVersion.getRight());
}
public void updateSegmentsValidationAndRetentionConfigFor(String tableName,
TableType type,
SegmentsValidationAndRetentionConfig newConfigs)
throws Exception {
String tableNameWithType =
TableNameBuilder.forType(type).tableNameWithType(tableName);
- TableConfig tableConfig =
ZKMetadataProvider.getTableConfig(_propertyStore, tableNameWithType);
- if (tableConfig == null) {
+ ImmutablePair<TableConfig, Integer> tableConfigWithVersion =
+ ZKMetadataProvider.getTableConfigWithVersion(_propertyStore,
tableNameWithType);
+ if (tableConfigWithVersion == null) {
throw new RuntimeException("Table: " + tableName + " of type: " + type +
" does not exist");
}
+ TableConfig tableConfig = tableConfigWithVersion.getLeft();
tableConfig.setValidationConfig(newConfigs);
- setExistingTableConfig(tableConfig);
+ setExistingTableConfig(tableConfig, tableConfigWithVersion.getRight());
}
public void updateIndexingConfigFor(String tableName, TableType type,
IndexingConfig newConfigs)
throws Exception {
String tableNameWithType =
TableNameBuilder.forType(type).tableNameWithType(tableName);
- TableConfig tableConfig =
ZKMetadataProvider.getTableConfig(_propertyStore, tableNameWithType);
- if (tableConfig == null) {
+ ImmutablePair<TableConfig, Integer> tableConfigWithVersion =
+ ZKMetadataProvider.getTableConfigWithVersion(_propertyStore,
tableNameWithType);
+ if (tableConfigWithVersion == null) {
throw new RuntimeException("Table: " + tableName + " of type: " + type +
" does not exist");
}
+ TableConfig tableConfig = tableConfigWithVersion.getLeft();
tableConfig.setIndexingConfig(newConfigs);
- setExistingTableConfig(tableConfig);
+ setExistingTableConfig(tableConfig, tableConfigWithVersion.getRight());
}
public void deleteUser(String username) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]