hpoenixf commented on code in PR #24278:
URL: https://github.com/apache/kafka/pull/24278#discussion_r4609974024


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/LRUCacheEntry.java:
##########
@@ -61,7 +61,10 @@ class LRUCacheEntry {
 
         this.isDirty = isDirty;
         this.sizeBytes = 1 + // isDirty
-            record.residentMemorySizeEstimate();
+            record.residentMemorySizeEstimate() +
+            // Raw source arrays are retained by cache entries, but are not 
serialized with the context.
+            (rawKey == null ? 0 : rawKey.length) +
+            (rawValue == null ? 0 : rawValue.length);

Review Comment:
   Addressed in 7a2ae22. After the flush listener returns successfully, 
`NamedCache.flush` releases the raw references and refunds their charge for 
entries that are still resident and clean. The charge is tracked independently 
of the context, so it is also refunded if the listener already freed the raw 
references. Replaced, removed, or newly dirty entries are left alone. Added 
regression coverage for listener-side release, failed flushes, and reentrant 
cache mutations.



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

Reply via email to