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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -178,7 +178,7 @@ private void buildMetaCache() {
         }
     }
 
-    private List<Pair<String, String>> listTableNames() {
+    private synchronized List<Pair<String, String>> listTableNames() {

Review Comment:
   This fixes the shared-map race by making `listTableNames()` synchronized, 
but that also means the `ExternalDatabase` monitor is held while this method 
performs `extCatalog.listTableNames(...)` below. For real external catalogs 
that call can be HMS/JDBC/REST metadata IO and may stall for seconds or longer. 
During that time `resetMetaToUninitialized()` cannot invalidate this DB, and 
every mode-2 miss in `getLocalTableName()` / `isTableExist()` queues behind the 
same monitor. That violates the FE locking guide requirement to avoid external 
IO while holding catalog/database locks and turns a slow remote list into a 
database-wide refresh/query stall.
   
   Please avoid using `lowerCaseToTableName` itself as the staging buffer. 
Build the remote table list and a temporary lowercase map off-lock, then 
publish the completed map under a short synchronized section (with a 
reset/generation guard if needed so a load that started before 
`resetMetaToUninitialized()` cannot republish stale state after the reset).



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