dengzhhu653 commented on code in PR #5696: URL: https://github.com/apache/hive/pull/5696#discussion_r2057524879
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java: ########## @@ -1233,56 +1233,48 @@ private void create_database_core(RawStore ms, final Database db) madeExternalDir = true; } } else { - if (dbMgdPath != null) { - try { - // Since this may be done as random user (if doAs=true) he may not have access - // to the managed directory. We run this as an admin user - madeManagedDir = UserGroupInformation.getLoginUser().doAs(new PrivilegedExceptionAction<Boolean>() { - @Override public Boolean run() throws MetaException { - if (!wh.isDir(dbMgdPath)) { - LOG.info("Creating database path in managed directory " + dbMgdPath); - if (!wh.mkdirs(dbMgdPath)) { - throw new MetaException("Unable to create database managed path " + dbMgdPath + ", failed to create database " + db.getName()); - } - return true; + final Path mgdPath = dbMgdPath != null ? dbMgdPath : defaultDbMgdPath; + try { Review Comment: could you create a new method for creating both the managed dir and the external dir? -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org