mjsax commented on a change in pull request #9572: URL: https://github.com/apache/kafka/pull/9572#discussion_r525439819
########## File path: streams/src/main/java/org/apache/kafka/streams/state/internals/ThreadCache.java ########## @@ -71,6 +72,26 @@ public long flushes() { return numFlushes; } + public void resize(final long maxCacheSizeBytes) { + final boolean shrink = maxCacheSizeBytes < this.maxCacheSizeBytes; + this.maxCacheSizeBytes = maxCacheSizeBytes; + if (shrink) { + final CircularIterator<NamedCache> circularIterator = new CircularIterator<>(caches.values()); + while (sizeBytes() > maxCacheSizeBytes) { + if (!circularIterator.hasNext()) { + log.error("Unable to remove any more entries as all caches are empty"); Review comment: I see. -- I guess the miss-leading fact was, that this check was done inside the while-loop. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org