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


##########
core/src/main/java/org/apache/gravitino/catalog/TableOperationDispatcher.java:
##########
@@ -198,9 +198,16 @@ public Table createTable(
   public Table alterTable(NameIdentifier ident, TableChange... changes)
       throws NoSuchTableException, IllegalArgumentException {
     validateAlterProperties(ident, 
HasPropertyMetadata::tablePropertiesMetadata, changes);
+
+    // Check if there exist TableChange.RenameTable in the changes, if so, we 
need to TreeLock of
+    // write on the new table name, or use the read lock on the table instead.
+    boolean containsRenameTable =
+        Arrays.stream(changes).anyMatch(c -> c instanceof 
TableChange.RenameTable);
+    LockType lockType = containsRenameTable ? LockType.WRITE : LockType.READ;

Review Comment:
   Sorry, it should be the `nameIdentifer` NOT `lockType` as other places.



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