vrajat commented on code in PR #15726:
URL: https://github.com/apache/pinot/pull/15726#discussion_r2077231384


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -2050,6 +2091,40 @@ public void setExistingTableConfig(TableConfig 
tableConfig)
     setExistingTableConfig(tableConfig, -1);
   }
 
+  /**
+   * Update the logical table config.
+   * @param logicalTableConfig The logical table config to be updated
+   * @throws TableNotFoundException If the logical table does not exist
+   */
+  public void updateLogicalTable(LogicalTableConfig logicalTableConfig)

Review Comment:
   Rename to `updateLogicalTableConfig`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -2170,6 +2245,33 @@ public void deleteTable(String tableName, TableType 
tableType, @Nullable String
     LOGGER.info("Deleting table {}: Finish", tableNameWithType);
   }
 
+  /**
+   * Deletes the logical table.
+   * @param tableName The logical table name
+   * @return True if the logical table was deleted, false otherwise
+   */
+  public boolean deleteLogicalTable(String tableName) {

Review Comment:
   Rename to `deleteLogicalTableConfig`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -1803,6 +1814,36 @@ public void addTable(TableConfig tableConfig)
     LOGGER.info("Adding table {}: Successfully added table", 
tableNameWithType);
   }
 
+  /**
+   * Adds a logical table.
+   * @param logicalTableConfig The logical table config to be added
+   * @throws TableAlreadyExistsException If the logical table already exists
+   */
+  public void addLogicalTable(LogicalTableConfig logicalTableConfig)

Review Comment:
   Rename to `addLogicalTableConfig`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -2050,6 +2091,40 @@ public void setExistingTableConfig(TableConfig 
tableConfig)
     setExistingTableConfig(tableConfig, -1);
   }
 
+  /**
+   * Update the logical table config.
+   * @param logicalTableConfig The logical table config to be updated
+   * @throws TableNotFoundException If the logical table does not exist
+   */
+  public void updateLogicalTable(LogicalTableConfig logicalTableConfig)
+      throws TableNotFoundException {
+    String tableName = logicalTableConfig.getTableName();
+    LOGGER.info("Updating logical table {}: Start", tableName);
+
+    if (!ZKMetadataProvider.isLogicalTableExists(_propertyStore, tableName)) {
+      throw new TableNotFoundException("Logical table: " + tableName + " does 
not exist");
+    }
+
+    LOGGER.info("Updating logical table {}: Updating logical table config in 
the property store", tableName);
+    ZKMetadataProvider.setLogicalTableConfig(_propertyStore, 
logicalTableConfig);
+
+    LOGGER.info("Updating logical table {}: Updating BrokerResource for 
table", tableName);
+    updateBrokerResourceForLogicalTable(logicalTableConfig, tableName);
+
+    LOGGER.info("Updated logical table {}: Successfully updated table", 
tableName);
+  }
+
+  private void updateBrokerResourceForLogicalTable(LogicalTableConfig 
logicalTableConfig, String tableName) {
+    List<String> brokers = HelixHelper.getInstancesWithTag(

Review Comment:
   What happens if this list is empty ? Curious how it is handled for physical 
tables.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -534,18 +534,29 @@ public List<String> getBrokerInstancesFor(String 
tableName) {
   }
 
   public List<InstanceConfig> getBrokerInstancesConfigsFor(String tableName) {
-    String brokerTenantName = null;
+    String brokerTenantName = getBrokerTenantName(tableName);
+    return 
HelixHelper.getInstancesConfigsWithTag(HelixHelper.getInstanceConfigs(_helixZkManager),
+        TagNameUtils.getBrokerTagForTenant(brokerTenantName));
+  }
+
+  private String getBrokerTenantName(String tableName) {

Review Comment:
   Add `@Nullable` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to