divijvaidya commented on code in PR #14511:
URL: https://github.com/apache/kafka/pull/14511#discussion_r1356830611
##########
storage/src/main/java/org/apache/kafka/storage/internals/log/RemoteIndexCache.java:
##########
@@ -137,15 +138,8 @@ public RemoteIndexCache(long maxSize, RemoteStorageManager
remoteStorageManager,
public void resizeCacheSize(long remoteLogIndexFileCacheSize) {
lock.writeLock().lock();
try {
- // When resizing the cache, we always start with an empty cache.
There are two main reasons:
- // 1. Resizing the cache is not a high-frequency operation, and
there is no need to fill the data in the old
- // cache to the new cache in time when resizing inside.
- // 2. Since the eviction of the caffeine cache is cleared
asynchronously, it is possible that after the entry
- // in the old cache is filled in the new cache, the old cache will
clear the entry, and the data in the two caches
- // will be inconsistent.
- internalCache.invalidateAll();
- log.info("Invalidated all entries in the cache and triggered the
cleaning of all index files in the cache dir.");
- internalCache = initEmptyCache(remoteLogIndexFileCacheSize);
+ internalCache.policy().eviction().orElseThrow(() -> new
NoSuchElementException("No eviction policy is set for the remote index cache.")
Review Comment:
Ah! I think the difference is that we use a builder to construct a new cache
in initCache() whereas we want to access a method (policy()) on existing cache
over here.
--
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]