This is an automated email from the ASF dual-hosted git repository.

jackie 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 964ff0ce85 Fix environment variables not applied when creating table 
(#12560)
964ff0ce85 is described below

commit 964ff0ce85e948e71ec3404877fd672567ca9b8d
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Tue Mar 5 11:56:34 2024 -0800

    Fix environment variables not applied when creating table (#12560)
---
 .../controller/helix/core/PinotHelixResourceManager.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

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 ab94f959b3..717d8dca4e 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
@@ -1604,7 +1604,13 @@ public class PinotHelixResourceManager {
     if (!ZKMetadataProvider.createTableConfig(_propertyStore, tableConfig)) {
       throw new RuntimeException("Failed to create table config for table: " + 
tableNameWithType);
     }
+
     try {
+      // Read table config from ZK to ensure we get consistent view across all 
APIs (e.g. environment variables applied,
+      // unknown fields dropped)
+      tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, 
tableNameWithType);
+      Preconditions.checkState(tableConfig != null, "Failed to read table 
config for table: %s", tableNameWithType);
+
       // Assign instances
       assignInstances(tableConfig, true);
       LOGGER.info("Adding table {}: Assigned instances", tableNameWithType);
@@ -1619,7 +1625,7 @@ public class PinotHelixResourceManager {
         LOGGER.info("Adding table {}: Added ideal state with first consuming 
segment", tableNameWithType);
       }
     } catch (Exception e) {
-      LOGGER.error("Caught exception during offline table setup. Cleaning up 
table {}", tableNameWithType, e);
+      LOGGER.error("Caught exception while setting up table: {}, cleaning it 
up", tableNameWithType, e);
       deleteTable(tableNameWithType, tableType, null);
       throw e;
     }
@@ -1856,8 +1862,9 @@ public class PinotHelixResourceManager {
       throws IOException {
     String tableNameWithType = tableConfig.getTableName();
     if (!ZKMetadataProvider.setTableConfig(_propertyStore, tableConfig, 
expectedVersion)) {
-      throw new RuntimeException("Failed to update table config in Zookeeper 
for table: " + tableNameWithType + " with"
-          + " expected version: " + expectedVersion);
+      throw new RuntimeException(
+          "Failed to update table config in Zookeeper for table: " + 
tableNameWithType + " with" + " expected version: "
+              + expectedVersion);
     }
 
     // Update IdealState replication
@@ -2182,8 +2189,7 @@ public class PinotHelixResourceManager {
    * @param updater to modify the job metadata in place
    * @return boolean representing success / failure of the ZK write step
    */
-  public boolean updateJobsForTable(String tableNameWithType, String jobType,
-      Consumer<Map<String, String>> updater) {
+  public boolean updateJobsForTable(String tableNameWithType, String jobType, 
Consumer<Map<String, String>> updater) {
     String jobResourcePath = 
ZKMetadataProvider.constructPropertyStorePathForControllerJob(jobType);
     Stat stat = new Stat();
     ZNRecord jobsZnRecord = _propertyStore.get(jobResourcePath, stat, 
AccessOption.PERSISTENT);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to