yuqi1129 commented on code in PR #9574:
URL: https://github.com/apache/gravitino/pull/9574#discussion_r2659448526


##########
core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java:
##########
@@ -190,6 +194,39 @@ public CatalogOperations ops() {
     return ops;
   }
 
+  public void checkMetalakeAndCatalogInUse(CatalogEntity catalogEntity) {
+    Map<String, String> catalogProperties = catalogEntity.getProperties();
+    if (catalogProperties == null) {
+      return;
+    }
+
+    boolean metalakeInuse =
+        Boolean.parseBoolean(
+            catalogProperties.getOrDefault(Catalog.PROPERTY_METALAKE_IN_USE, 
"true"));
+    if (!metalakeInuse) {
+      throw new MetalakeNotInUseException(
+          "The metalake that holds catalog %s is not in use", 
catalogEntity.name());
+    }
+
+    // Check the stack and find whether its within method `dropCatalog` as we 
don't need to check
+    // the catalog in use status when dropping the catalog.
+    if (isInvokedBy("dropCatalog")) {
+      LOG.info("Skip checking catalog in use status since it's invoked by 
dropCatalog method.");
+      return;

Review Comment:
   > Does this mean we are doing redundant checks? Can we optimize this part of 
the logic?
   
   
   What I mean is that:  We will check the status of the in-use catalog 
manager, as the catalog manager will not call catalog operations(schema, table 
operations) normally, then `checkMetalakeAndCatalogInUse` will not be called. 
   
   Typically, `checkMetalakeAndCatalogInUse` is targeted for schema and 
table-level operations.



##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -592,20 +575,54 @@ public void enableCatalog(NameIdentifier ident)
         });
   }
 
+  public void updateCatalogProperty(

Review Comment:
   updated



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

Reply via email to