Jackie-Jiang commented on code in PR #15726: URL: https://github.com/apache/pinot/pull/15726#discussion_r2080216939
########## pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java: ########## @@ -417,6 +417,12 @@ public synchronized void includeServerToRouting(String instanceId) { * Builds/rebuilds the routing for the given table. */ public synchronized void buildRouting(String tableNameWithType) { Review Comment: (minor) The argument no longer always have type suffix. Consider putting some comments explaining it ########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java: ########## @@ -1803,6 +1815,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 addLogicalTableConfig(LogicalTableConfig logicalTableConfig) + throws TableAlreadyExistsException { + String tableName = logicalTableConfig.getTableName(); + LOGGER.info("Adding logical table {}: Start", tableName); + + // Check if the logical table name is already used + if (ZKMetadataProvider.isLogicalTableExists(_propertyStore, tableName)) { + throw new TableAlreadyExistsException("Logical table: " + tableName + " already exists"); + } + + // Check if the table name is already used by a physical table + getAllTables().stream().map(TableNameBuilder::extractRawTableName).distinct().filter(tableName::equals) Review Comment: A much cheaper way is to check if the 2 corresponding table names (with `_OFFLINE` and `_REALTIME`) exists. We want to add the same check when adding physical table to avoid collision with logical table name. -- 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