github-actions[bot] commented on code in PR #64705:
URL: https://github.com/apache/doris/pull/64705#discussion_r3459753361
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/metacache/MetaCacheEntry.java:
##########
@@ -155,31 +188,96 @@ public MetaCacheEntryStats stats() {
cacheStats.hitCount(),
cacheStats.missCount(),
cacheStats.hitRate(),
- cacheStats.loadSuccessCount(),
- cacheStats.loadFailureCount(),
- cacheStats.totalLoadTime(),
- cacheStats.averageLoadPenalty(),
+ successCount,
+ failureCount,
+ totalLoadTime,
+ totalLoadCount == 0 ? 0D : (double) totalLoadTime /
totalLoadCount,
cacheStats.evictionCount(),
invalidateCount.get(),
lastLoadSuccessTimeMs.get(),
lastLoadFailureTimeMs.get(),
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) {
+ V value = data.getIfPresent(key);
+ if (value != null) {
+ return value;
+ }
+
+ synchronized (loadLock(key)) {
+ value = data.asMap().get(key);
+ if (value != null) {
+ return value;
+ }
+
+ long generation = invalidateGeneration.get();
+ V loaded = loadAndTrack(key, loadFunction);
+ if (generation != invalidateGeneration.get()) {
+ return loaded;
+ }
+
+ // Keep null results uncached so manual miss load matches
LoadingCache null-return behavior.
+ if (loaded == null) {
Review Comment:
`effectiveEnabled=false` currently still goes through this manual path and
writes the loaded value into the Caffeine cache. The constructor represents
disabled entries as a cache with `maximumSize(0)`, but a direct `Cache.put` is
still visible to `getIfPresent` until Caffeine runs maintenance, so a catalog
that sets `meta.cache.<engine>.<entry>.enable=false` or `ttl-second=0` can
still return a cached external metadata value on later calls instead of
reloading every time. The legacy `LoadingCache.get` path does not rely on this
explicit post-load `put`, so please skip the put when `!effectiveEnabled` (or
route disabled entries through the original loading path) to preserve the
cache-disable contract.
--
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]