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


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/LRUCacheEntry.java:
##########
@@ -93,13 +102,13 @@ public boolean equals(final Object o) {
             return false;
         }
         final LRUCacheEntry that = (LRUCacheEntry) o;
-        return sizeBytes == that.sizeBytes &&
+        return size() == that.size() &&
             isDirty() == that.isDirty() &&
             Objects.equals(record, that.record);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(record, sizeBytes, isDirty());
+        return Objects.hash(record, size(), isDirty());

Review Comment:
   Addressed in 898a372. `hashCode()` now throws 
`UnsupportedOperationException`, consistent with `ContextualRecord`. The new 
`entryEqualityIgnoresRetainedRawRecordCharge` regression passed in the macOS 
run of `ThreadCacheTest` and `NamedCacheTest` (61 passed, 0 failed, 0 skipped).
   



##########
streams/src/test/java/org/apache/kafka/streams/state/internals/ThreadCacheTest.java:
##########
@@ -136,8 +136,12 @@ public void cacheOverheadsLargeValues() {
     }
 
 
-    static long memoryCacheEntrySize(final byte[] key, final byte[] value, 
final String topic) {
-        return key.length +
+    static long memoryCacheEntrySize(final byte[] key,
+                                     final byte[] value,
+                                     final String topic,
+                                     final int rawKeySize,
+                                     final int rawValueSize) {
+        return (long) rawKeySize + rawValueSize +
             value.length +

Review Comment:
   I checked `memoryCacheEntrySize` at 898a372. It includes `key.length` in the 
LRU node portion of the sum, matching `NamedCache.LRUNode.size()`. The cache 
value and retained raw key/value lengths are counted separately. The macOS run 
passed all 41 `ThreadCacheTest` cases.
   



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