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


##########
fe/fe-connector/fe-connector-cache/src/main/java/org/apache/doris/connector/cache/ScopedMetaCache.java:
##########
@@ -1144,6 +1150,11 @@ private void completeRemoval(
             VersionedValue<K, V> versioned, RemovalCause cause, boolean 
budgetEviction) {
         if (cause.wasEvicted() || budgetEviction) {
             evictionCount.increment();
+            if (weightBounded) {
+                // Every value of a bounded cache holds a reservation; it is 
released below.
+                evictionWeight.accumulateAndGet(
+                        versioned.registration.reservation.getBytes(), 
JvmSizeUtils::saturatedAdd);

Review Comment:
   [P2] Preserve the admitted byte count through deferred eviction accounting
   
   An eviction can permanently add zero bytes here. After thread A removes a 
weighted value for expiry, capacity or budget reclamation, its deferred 
callback can pause before this read. Thread B can then call invalidateKey(key): 
the old registration is still attached, the value is already absent from data, 
and the registration CAS/release at lines 490-491 calls 
MetaCacheBudgetManager.release(), which sets reservation.bytes to 0. When A 
resumes, evictionCount increments but EVICTION_WEIGHT loses that value's entire 
weight. The deferred drain holds no publication gate or key-node monitor that 
prevents this schedule. Preserve the admitted generation's immutable weight for 
the removal event instead of reading the live reservation after another path 
can release it, and cover eviction racing with invalidation.



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