geyanggang commented on code in PR #13481:
URL: https://github.com/apache/gravitino/pull/13481#discussion_r4092256484


##########
core/src/main/java/org/apache/gravitino/catalog/TableOperationDispatcher.java:
##########
@@ -159,26 +160,38 @@ public NameIdentifier[] listTables(Namespace namespace) 
throws NoSuchSchemaExcep
    */
   @Override
   public Table loadTable(NameIdentifier ident) throws NoSuchTableException {
+    // Resolve the physical name (for backends whose normalization is not 
reversible) under a READ
+    // lock, so the resolved name and the load that follows act atomically. 
The resolved identifier
+    // then drives the catalog call, the entity store key and the per-table 
locks below. For the
+    // common catalog that does not implement the resolution capability this 
is a no-op returning
+    // ident.
+    NameIdentifier resolvedIdent =
+        TreeLockUtils.doWithTreeLock(ident, LockType.READ, () -> 
resolvePhysicalName(ident));

Review Comment:
   Resolved — TableNormalizeDispatcher takes no lock, so no extra tree-lock on 
loadTable. Reworded the Javadoc to "best-effort" (the locked downstream op 
re-checks existence) instead of "atomic".



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