chenboat commented on a change in pull request #4608: Unit tests and bug fixes for DeleteTable rest API for controller. URL: https://github.com/apache/incubator-pinot/pull/4608#discussion_r324223312
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java ########## @@ -254,14 +254,20 @@ public SuccessResponse deleteTable( List<String> tablesDeleted = new LinkedList<>(); try { - if (tableType != TableType.REALTIME && !TableNameBuilder.REALTIME.tableHasTypeSuffix(tableName)) { + if (tableType != TableType.REALTIME && !TableNameBuilder.REALTIME.tableHasTypeSuffix(tableName) + && _pinotHelixResourceManager.hasOfflineTable(tableName)) { _pinotHelixResourceManager.deleteOfflineTable(tableName); tablesDeleted.add(TableNameBuilder.OFFLINE.tableNameWithType(tableName)); } - if (tableType != TableType.OFFLINE && !TableNameBuilder.OFFLINE.tableHasTypeSuffix(tableName)) { + if (tableType != TableType.OFFLINE && !TableNameBuilder.OFFLINE.tableHasTypeSuffix(tableName) + && _pinotHelixResourceManager.hasRealtimeTable(tableName)) { _pinotHelixResourceManager.deleteRealtimeTable(tableName); tablesDeleted.add(TableNameBuilder.REALTIME.tableNameWithType(tableName)); } + if (tablesDeleted.size() == 0) { Review comment: Right now if the table does not exist, the rest end point still returns "Success [table_non_existent] deleted". This is not consistent with system state -- that is why I think it is a bug (though minor). Thank you for the overflow. It is interesting and new to me. Both sides has valid points. I think there is argument for idem-potency there -- but Pinot controller is not a stateless service (it has zk data for table state) IMO. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org