yuqi1129 commented on code in PR #5084:
URL: https://github.com/apache/gravitino/pull/5084#discussion_r1794584395
##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -376,22 +376,29 @@ public Catalog createCatalog(
store.put(e, false /* overwrite */);
CatalogWrapper wrapper = catalogCache.get(ident, id ->
createCatalogWrapper(e));
- createSuccess = true;
+
+ needClean = false;
return wrapper.catalog;
+
} catch (EntityAlreadyExistsException e1) {
+ needClean = false;
LOG.warn("Catalog {} already exists", ident, e1);
throw new CatalogAlreadyExistsException("Catalog %s already exists",
ident);
+
} catch (IllegalArgumentException | NoSuchMetalakeException e2) {
throw e2;
+
} catch (Exception e3) {
catalogCache.invalidate(ident);
LOG.error("Failed to create catalog {}", ident, e3);
if (e3 instanceof RuntimeException) {
throw (RuntimeException) e3;
}
throw new RuntimeException(e3);
+
} finally {
- if (!createSuccess) {
+ if (needClean) {
+ // Clean up the default schema under the catalog if creation failed
Review Comment:
// Clean up the default schema under the catalog if creation failed
I believe this scenario is only used for kafka catalog currently, so can you
add more information about it?
--
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]