dengzhhu653 commented on code in PR #6777:
URL: https://github.com/apache/hive/pull/6777#discussion_r4031966603


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/CreateDatabaseHandler.java:
##########
@@ -160,36 +160,8 @@ protected CreateDatabaseResult execute() throws 
TException, IOException {
       success = ms.commitTransaction();
     } finally {
       if (!success) {
+        // mkdirs does not establish exclusive ownership of a directory.
         ms.rollbackTransaction();
-        if (db.getCatalogName() != null && 
!db.getCatalogName().equals(Warehouse.DEFAULT_CATALOG_NAME)) {

Review Comment:
   In my opinion, dropping this cleanup on failure is not a good idea, there 
might be some other failures that prevent the database creation, and we should 
remove the created directory.
   
   For this jira's case, I think we can check the reason why the database 
creation is failed, e.g, SQLIntegrityConstraintViolationException, and only 
when there is the same database with the same location created in HMS, then we 
can ignore dropping the paths created.



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