diff --git a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java index bba6217c504a9..48306792efcf9 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java +++ b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java @@ -116,7 +116,7 @@ public final class IndicesRequestCache implements RemovalListener cache; - private final Function cacheEntityFunction; + private final Function cacheEntityLookup; IndicesRequestCache(Settings settings, Function cacheEntityFunction) { this.size = INDICES_CACHE_QUERY_SIZE.get(settings); @@ -130,7 +130,7 @@ public final class IndicesRequestCache implements RemovalListener notification) { - cacheEntityFunction.apply(notification.getKey().shardId).onRemoval(notification); + cacheEntityLookup.apply(notification.getKey().shardId).onRemoval(notification); } BytesReference getOrCompute( @@ -379,10 +379,10 @@ synchronized void cleanCache() { if (!currentKeysToClean.isEmpty() || !currentFullClean.isEmpty()) { for (Iterator iterator = cache.keys().iterator(); iterator.hasNext();) { Key key = iterator.next(); - if (currentFullClean.contains(cacheEntityFunction.apply(key.shardId).getCacheIdentity())) { + if (currentFullClean.contains(cacheEntityLookup.apply(key.shardId).getCacheIdentity())) { iterator.remove(); } else { - if (currentKeysToClean.contains(new CleanupKey(cacheEntityFunction.apply(key.shardId), key.readerCacheKeyId))) { + if (currentKeysToClean.contains(new CleanupKey(cacheEntityLookup.apply(key.shardId), key.readerCacheKeyId))) { iterator.remove(); } } diff --git a/server/src/main/java/org/opensearch/indices/IndicesService.java b/server/src/main/java/org/opensearch/indices/IndicesService.java index 635fe2a07ed2d..4b2f823014f82 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesService.java +++ b/server/src/main/java/org/opensearch/indices/IndicesService.java @@ -333,7 +333,7 @@ public class IndicesService extends AbstractLifecycleComponent private final ScriptService scriptService; private final ClusterService clusterService; private final Client client; - private volatile Map indices = new ConcurrentHashMap<>(); + private Map indices = new ConcurrentHashMap<>(); private final Map> pendingDeletes = new HashMap<>(); private final AtomicInteger numUncompletedDeletes = new AtomicInteger(); private final OldShardsStats oldShardsStats = new OldShardsStats();