yuqi1129 commented on code in PR #2873: URL: https://github.com/apache/gravitino/pull/2873#discussion_r1974879819
########## 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: The following scenario will cause problems if we use write lock in the schema level,assuming the schema name is `schema1` ``` TheadA ThreadB hold schema1 write lock rename schema1 to schema2 store schema2 to storage hold schema2 write lock block due to some reason rename schema2 to schema1 return store schema2 to storage return ``` -- 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