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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -691,14 +691,16 @@ public void invalidateTableLookupDependencies() {
     }
 
     public Optional<Runnable> beginTableMetadataRefresh() {
-        return metaCache == null ? Optional.empty() : 
Optional.of(metaCache.beginMetadataRefresh());
+        extCatalog.beginTableLookupRefresh();
+        return Optional.of(extCatalog::endTableLookupRefresh);
     }
 
     /** A missing result is authorized only against the retained DB, names and 
object generations. */
     @SuppressWarnings("unchecked")
     public Optional<Runnable> observeTableLookup(ExternalTable table) {
+        OptionalLong refreshGeneration = 
extCatalog.observeTableLookupRefreshGeneration();

Review Comment:
   [P2] Reject retired observations before taking the catalog monitor
   
   `observeTableLookupRefreshGeneration()` is synchronized, so calling it 
before the existing eligibility checks adds a wait even when this DB is already 
retired. For example, a Paimon branch query can retain a `PaimonMvccSnapshot`, 
then a catalog reset completes and another query enters synchronized 
`makeSureInitialized()`/`createCatalog()`. If the original query calls 
`getFullSchema(snapshot)`, its `schemaFromSnapshotTable` path only projects the 
retained table's schema, and previously the stale epoch/uninitialized DB check 
let it proceed immediately. It now waits for the other query's connector 
initialization before rejecting the observation, so slow initialization can 
stall an in-flight query that needs no replacement runtime. Keep the 
initialized/cache/retained-epoch rejection before this synchronized 
observation, while retaining the final generation check around cleanup.



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