Gezi-lzq opened a new pull request, #6777: URL: https://github.com/apache/hive/pull/6777
### What changes were proposed in this pull request? Remove recursive managed/external database directory cleanup from the failed `create_database` rollback path in `CreateDatabaseHandler`. Add a regression test covering a duplicate database creation failure and verifying that `Warehouse.deleteDir` is not called. Issue: https://issues.apache.org/jira/browse/HIVE-29843 ### Why are the changes needed? Concurrent clients can create the same database directory before the metadata uniqueness race is resolved. A failed request's `madeManagedDir` or `madeExternalDir` flag records directory creation but does not prove exclusive ownership. The failed request can therefore delete or move a directory already adopted by the successful request, leaving Hive metadata and Iceberg object-storage files inconsistent. The safe immediate behavior is to roll back the metastore transaction without deleting the final database directory. This may leave an empty directory, but avoids deleting shared data. Request-private staging cleanup can be addressed separately if needed. ### Does this PR introduce _any_ user-facing change? No. This changes failure cleanup behavior for concurrent database creation. Empty directories may remain after a failed request, while shared database directories are preserved. ### How was this patch tested? - `mvn -B -Dtest=TestCreateDatabaseHandler -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -Dcheckstyle.skip=true -Drat.skip=true test` - Java 22 / Maven 3.6.3 - Tests run: 1, Failures: 0, Errors: 0 - `git diff --check` passed. The repository-wide Checkstyle invocation is currently blocked by pre-existing license-header violations in unrelated files (`service-rpc/src/test/.../TestDelegationTokenRequestRedaction.java` and four existing metastore handler files). No Checkstyle violation was reported for the changed files. -- 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]
