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


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -466,6 +470,23 @@ private boolean verifyTableType(String tableName, 
TableType tableType, TableType
     return typeFromTableName == null || typeFromTableName == expectedType;
   }
 
+  private void validateLogicalTableReference(String tableName) {
+    String rawTableName = TableNameBuilder.extractRawTableName(tableName);
+    List<LogicalTableConfig> allLogicalTableConfigs =
+        
ZKMetadataProvider.getAllLogicalTableConfigs(_pinotHelixResourceManager.getPropertyStore());
+    for (LogicalTableConfig logicalTableConfig : allLogicalTableConfigs) {

Review Comment:
   Do you also need to check in `physicalTableConfigMap` ? 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java:
##########
@@ -282,7 +284,23 @@ public SuccessResponse deleteConfig(
       @ApiParam(value = "TableConfigs name i.e. raw table name", required = 
true) @PathParam("tableName")
       String tableName, @Context HttpHeaders headers) {
     try {
+      if (TableNameBuilder.isOfflineTableResource(tableName) || 
TableNameBuilder.isRealtimeTableResource(tableName)) {
+        throw new ControllerApplicationException(LOGGER, "Invalid table name: 
" + tableName + ". Use raw table name.",
+            Response.Status.BAD_REQUEST);
+      }
+
       tableName = DatabaseUtils.translateTableName(tableName, headers);
+
+      // Validate the table is not referenced in any logical table config.
+      List<LogicalTableConfig> allLogicalTableConfigs =
+          
ZKMetadataProvider.getAllLogicalTableConfigs(_pinotHelixResourceManager.getPropertyStore());
+      for (LogicalTableConfig logicalTableConfig : allLogicalTableConfigs) {

Review Comment:
   Do you also need to check in `physicalTableConfigMap` ? 



-- 
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