yashmayya commented on code in PR #16898:
URL: https://github.com/apache/pinot/pull/16898#discussion_r2380064284


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -228,6 +228,13 @@ public ConfigSuccessResponse addTable(String 
tableConfigStr,
       ResourceUtils.checkPermissionAndAccess(tableNameWithType, request, 
httpHeaders,
           AccessType.CREATE, Actions.Table.CREATE_TABLE, 
_accessControlFactory, LOGGER);
 
+      // fail if table entry is present in IS. This saves all the validation 
checks if table already exists
+      if (_pinotHelixResourceManager.hasTable(tableNameWithType)) {

Review Comment:
   Why is this existence check different from the one in `POST /tableConfigs`?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -228,6 +228,13 @@ public ConfigSuccessResponse addTable(String 
tableConfigStr,
       ResourceUtils.checkPermissionAndAccess(tableNameWithType, request, 
httpHeaders,
           AccessType.CREATE, Actions.Table.CREATE_TABLE, 
_accessControlFactory, LOGGER);
 
+      // fail if table entry is present in IS. This saves all the validation 
checks if table already exists
+      if (_pinotHelixResourceManager.hasTable(tableNameWithType)) {
+        throw new TableAlreadyExistsException("Table config for " + 
tableNameWithType
+            + " already exists. If this is unexpected, try deleting the table 
to remove all metadata associated"
+            + " with it.");

Review Comment:
   ```suggestion
           throw new TableAlreadyExistsException("Table config for " + 
tableNameWithType
               + " already exists. If this is unexpected, try deleting the 
table to remove all metadata associated"
               + " with it before attempting to recreate.");
   ```
   nit



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to