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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -714,26 +711,38 @@ public void resetToUninitialized(boolean invalidCache) {
      */
     public void onRefreshCache(boolean invalidCache) {
         setLastUpdateTime(System.currentTimeMillis());
-        refreshMetaCacheOnly(invalidCache);
-        if (invalidCache) {
-            Env.getCurrentEnv().getExtMetaCacheMgr().invalidateCatalog(id);
+        try {
+            refreshMetaCacheOnly(invalidCache);
+        } finally {
+            if (invalidCache) {
+                Env.getCurrentEnv().getExtMetaCacheMgr().invalidateCatalog(id);
+            }
         }
     }
 
     /**
      * Refresh meta cache only (database level cache), without invalidating 
catalog level cache.
      */
-    private void refreshMetaCacheOnly(boolean invalidCache) {
+    private synchronized void refreshMetaCacheOnly(boolean invalidCache) {

Review Comment:
   [P2] Move bulk cache retirement out of the catalog monitor. 
`refreshMetaCacheOnly` is now `synchronized` and calls 
`metaCache.invalidateAll()` before releasing `this`. That call synchronously 
invokes the removal listener for every resident DB, each of which retires its 
table-object cache; on metadata-only refresh it can also evict connector 
entries. Both `getDbNames()` and `getDbNullable()` enter synchronized 
`makeSureInitialized()`, so scheduled REFRESH CATALOG blocks ordinary metadata 
planning for the entire O(resident DBs + tables) teardown (the default DB 
object-cache limit is 1000). Serialize the generation transition under the 
monitor, run returned retirement callbacks after releasing it, and keep the 
row-count fences around the transition.



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