jerryshao commented on code in PR #2873:
URL: https://github.com/apache/gravitino/pull/2873#discussion_r1974886527

##########
core/src/main/java/org/apache/gravitino/catalog/SchemaOperationDispatcher.java:
##########
@@ -201,68 +213,73 @@ public Schema loadSchema(NameIdentifier ident) throws 
NoSuchSchemaException {
   @Override
   public Schema alterSchema(NameIdentifier ident, SchemaChange... changes)
       throws NoSuchSchemaException {
-    validateAlterProperties(ident, 
HasPropertyMetadata::schemaPropertiesMetadata, changes);
 
     NameIdentifier catalogIdent = getCatalogIdentifier(ident);
-    Schema alteredSchema =
-        doWithCatalog(
-            catalogIdent,
-            c -> c.doWithSchemaOps(s -> s.alterSchema(ident, changes)),
-            NoSuchSchemaException.class);
-
-    // If the Schema is maintained by the Gravitino's store, we don't have to 
alter again.
-    boolean isManagedSchema = isManagedEntity(catalogIdent, 
Capability.Scope.SCHEMA);
-    if (isManagedSchema) {
-      return EntityCombinedSchema.of(alteredSchema)
-          .withHiddenProperties(
-              getHiddenPropertyNames(
+    return TreeLockUtils.doWithTreeLock(
+        NameIdentifier.of(ident.namespace().levels()),

Review Comment:
   This problem only happens for rename, I think we don't support schema 
rename. Besides, we can treat rename and other change separately, if the 
changes contain `rename`, then we use parent level write lock, otherwise we use 
its own write lock. WDYT?



-- 
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: commits-unsubscr...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to