wenzhenghu commented on code in PR #65126:
URL: https://github.com/apache/doris/pull/65126#discussion_r3687368501


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/metacache/MetaCacheEntry.java:
##########
@@ -205,65 +372,247 @@ public MetaCacheEntryStats stats() {
                 lastError.get());
     }
 
-    // Read the config dynamically so existing cache entries follow runtime 
config updates.
-    private boolean isManualMissLoadEnabled() {
-        return Config.enable_external_meta_cache_manual_miss_load;
-    }
-
     // Execute slow miss loads outside Caffeine's sync load path and suppress 
stale write-back after invalidation.
-    private V getWithManualLoad(K key, Function<K, V> loadFunction) {
+    private V getWithManualLoad(K key, Function<K, V> loadFunction,
+            @Nullable BiPredicate<K, V> currentValueActionRequired,
+            @Nullable BiConsumer<K, V> currentValueAction) {
         if (!effectiveEnabled) {
-            // Bypass cache entirely when the entry is disabled so manual miss 
load does not relax disable semantics.
-            return loadAndTrack(key, loadFunction);
+            if (currentValueAction == null) {
+                // Preserve the ordinary disabled-entry path without adding 
publication coordination.
+                return loadAndTrack(key, loadFunction);
+            }
+            // Bypass object publication when disabled, but still fence an 
auxiliary-index update against invalidation.
+            StripeState state = stripeState(key);
+            long generation;
+            synchronized (state) {
+                generation = generationOf(state);
+            }
+            V loaded = loadAndTrack(key, loadFunction);
+            if (loaded == null) {
+                return loaded;
+            }
+            beforeCurrentValueActionForTest(key, loaded);
+            synchronized (state) {
+                if (generation == generationOf(state)

Review Comment:
   Fixed in `02615b248a5`.
   
   The object-cache and auxiliary ID-index publication decisions are now 
separated. Object values remain protected by the existing stripe generation, 
while a load that may update `dbIdToName` or `tableIdToName` registers a 
bounded exact-key action token. A mutation of the same key, matching 
`invalidateIf()`, or `invalidateAll()` invalidates that token; an unrelated key 
in the same stripe no longer suppresses the ID-to-name update even if the 
object publication is rejected.
   
   The active per-key state exists only while relevant loads are in flight and 
is released through `finally`, including null and exception paths. The change 
covers enabled and disabled/TTL-0 entries, all public mutation paths, 
selective/global invalidation, and the real 
`ExternalCatalog`/`ExternalDatabase` ID-navigation callers. Focused FE UTs 
passed before the final comment-only cleanup; FE checkstyle and `git diff 
--check` pass on the final commit.



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