github-actions[bot] commented on code in PR #70730:
URL: https://github.com/apache/doris/pull/70730#discussion_r4623061859


##########
fe/fe-core/src/main/java/org/apache/doris/common/util/FetchRemoteTabletSchemaUtil.java:
##########
@@ -62,12 +61,18 @@
 public class FetchRemoteTabletSchemaUtil {
     private static final Logger LOG = 
LogManager.getLogger(FetchRemoteTabletSchemaUtil.class);
 
-    private final List<Tablet> remoteTablets;
-    private final List<Column> tableColumns;
+    private final Map<Long, Set<Long>> beIdToTabletId = Maps.newHashMap();
 
     public FetchRemoteTabletSchemaUtil(List<Tablet> tablets) {
-        this.remoteTablets = tablets;
-        this.tableColumns = Lists.newArrayList();
+        // Snapshot tablet locations while the caller holds the table lock.
+        for (Tablet tablet : tablets) {
+            for (Replica replica : tablet.getReplicas()) {
+                if (replica.isAlive()) {
+                    
beIdToTabletId.computeIfAbsent(replica.getBackendIdWithoutException(), id -> 
Sets.newHashSet())

Review Comment:
   [P2] Resolve cloud routing before taking the table lock
   
   For `CloudReplica`, `getBackendIdWithoutException()` calls 
`getCurrentClusterId()` -> `resolveClusterIdByName()` -> `waitForAutoStart()`, 
which can issue a resume RPC and sleep for minutes. Both directory snapshot 
paths now invoke this constructor while holding `table.readLock()`. An admin 
running extended `SHOW PROC 
'/dbs/<db>/<table>/index_schema/<index>/<partition>'` after their compute group 
auto-suspends therefore holds the table lock throughout resumption, blocking 
concurrent table DDL (`dropTableInternal` waits for the table write lock while 
holding the database lock). Before this change, SHOW PROC resolved these 
backend IDs in `fetch()`, after the directory released its table lock. 
Resolve/activate the cloud compute group before acquiring the lock and snapshot 
routes using the already resolved group.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to