showuon commented on code in PR #14483: URL: https://github.com/apache/kafka/pull/14483#discussion_r1346940422
########## storage/src/main/java/org/apache/kafka/storage/internals/log/RemoteIndexCache.java: ########## @@ -169,7 +169,16 @@ public Cache<Uuid, Entry> internalCache() { public void remove(Uuid key) { lock.readLock().lock(); try { - internalCache.invalidate(key); + internalCache.asMap().computeIfPresent(key, (k, v) -> { + try { + v.markForCleanup(); + v.cleanup(); Review Comment: `markForCleanup` is enough, it'll set the cleanup flag as true, and rename files. `cleanup` can be done in a cleanup thread. ########## storage/src/main/java/org/apache/kafka/storage/internals/log/RemoteIndexCache.java: ########## @@ -178,7 +187,16 @@ public void remove(Uuid key) { public void removeAll(Collection<Uuid> keys) { lock.readLock().lock(); try { - internalCache.invalidateAll(keys); + keys.forEach(key -> internalCache.asMap().computeIfPresent(key, (k, v) -> { + try { + v.markForCleanup(); Review Comment: ditto -- 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