ableegoldman commented on code in PR #12903: URL: https://github.com/apache/kafka/pull/12903#discussion_r1041647625
########## streams/src/main/java/org/apache/kafka/streams/state/internals/ThreadCache.java: ########## @@ -241,35 +267,30 @@ private boolean isOverflowing(final long size) { } long sizeBytes() { - long sizeInBytes = 0; - for (final NamedCache namedCache : caches.values()) { - sizeInBytes += namedCache.sizeInBytes(); - if (isOverflowing(sizeInBytes)) { - return Long.MAX_VALUE; - } - } - return sizeInBytes; + return sizeInBytes.get(); } synchronized void close(final String namespace) { final NamedCache removed = caches.remove(namespace); if (removed != null) { + sizeInBytes.getAndAdd(-removed.sizeInBytes()); removed.close(); } } - private void maybeEvict(final String namespace) { + private void maybeEvict(final String namespace, final NamedCache cache) { Review Comment: ah I guess that was obscured in the Github view, makes sense -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org