From f60fb08a247c5021f3b51efd7d6aa676efac43c9 Mon Sep 17 00:00:00 2001 From: Peter Alfonsi Date: Thu, 11 Apr 2024 18:33:21 -0700 Subject: [PATCH] Renamed snapshot -> ImmutableCacheStats Signed-off-by: Peter Alfonsi --- .../store/disk/EhCacheDiskCacheTests.java | 4 +-- .../common/cache/stats/CacheStats.java | 8 ++--- .../common/cache/stats/CacheStatsHolder.java | 18 +++++----- ...Snapshot.java => ImmutableCacheStats.java} | 14 ++++---- .../stats/ImmutableCacheStatsHolder.java | 14 ++++---- .../cache/stats/CacheStatsHolderTests.java | 36 +++++++++---------- .../stats/ImmutableCacheStatsHolderTests.java | 14 ++++---- .../store/OpenSearchOnHeapCacheTests.java | 4 +-- .../indices/IndicesRequestCacheTests.java | 12 +++---- 9 files changed, 61 insertions(+), 63 deletions(-) rename server/src/main/java/org/opensearch/common/cache/stats/{CacheStatsSnapshot.java => ImmutableCacheStats.java} (81%) diff --git a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java index 408e1370a9ea3..c40c937d223ad 100644 --- a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java +++ b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java @@ -20,7 +20,7 @@ import org.opensearch.common.cache.RemovalNotification; import org.opensearch.common.cache.serializer.BytesReferenceSerializer; import org.opensearch.common.cache.serializer.Serializer; -import org.opensearch.common.cache.stats.CacheStatsSnapshot; +import org.opensearch.common.cache.stats.ImmutableCacheStats; import org.opensearch.common.cache.store.config.CacheConfig; import org.opensearch.common.metrics.CounterMetric; import org.opensearch.common.settings.Settings; @@ -828,7 +828,7 @@ public void testInvalidateWithDropDimensions() throws Exception { ICacheKey keyToDrop = keysAdded.get(0); - CacheStatsSnapshot snapshot = ehCacheDiskCachingTier.stats().getStatsForDimensionValues(keyToDrop.dimensions); + ImmutableCacheStats snapshot = ehCacheDiskCachingTier.stats().getStatsForDimensionValues(keyToDrop.dimensions); assertNotNull(snapshot); keyToDrop.setDropStatsForDimensions(true); diff --git a/server/src/main/java/org/opensearch/common/cache/stats/CacheStats.java b/server/src/main/java/org/opensearch/common/cache/stats/CacheStats.java index e7136f60b870d..b0cb66b56b70d 100644 --- a/server/src/main/java/org/opensearch/common/cache/stats/CacheStats.java +++ b/server/src/main/java/org/opensearch/common/cache/stats/CacheStats.java @@ -54,14 +54,14 @@ public void add(CacheStats other) { internalAdd(other.getHits(), other.getMisses(), other.getEvictions(), other.getSizeInBytes(), other.getEntries()); } - public void add(CacheStatsSnapshot snapshot) { + public void add(ImmutableCacheStats snapshot) { if (snapshot == null) { return; } internalAdd(snapshot.getHits(), snapshot.getMisses(), snapshot.getEvictions(), snapshot.getSizeInBytes(), snapshot.getEntries()); } - public void subtract(CacheStatsSnapshot other) { + public void subtract(ImmutableCacheStats other) { if (other == null) { return; } @@ -126,7 +126,7 @@ public void resetSizeAndEntries() { entries = new CounterMetric(); } - public CacheStatsSnapshot snapshot() { - return new CacheStatsSnapshot(hits.count(), misses.count(), evictions.count(), sizeInBytes.count(), entries.count()); + public ImmutableCacheStats immutableSnapshot() { + return new ImmutableCacheStats(hits.count(), misses.count(), evictions.count(), sizeInBytes.count(), entries.count()); } } diff --git a/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsHolder.java b/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsHolder.java index 7103047cf7a3a..214b14e9fefdd 100644 --- a/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsHolder.java +++ b/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsHolder.java @@ -156,7 +156,7 @@ private boolean internalIncrementHelper( * Produce an immutable version of these stats. */ public ImmutableCacheStatsHolder getImmutableCacheStatsHolder() { - ImmutableCacheStatsHolder.Node snapshot = new ImmutableCacheStatsHolder.Node("", true, statsRoot.getStatsSnapshot()); + ImmutableCacheStatsHolder.Node snapshot = new ImmutableCacheStatsHolder.Node("", true, statsRoot.getImmutableStats()); // Traverse the tree and build a corresponding tree of MDCSDimensionNode, to pass to MultiDimensionCacheStats. if (statsRoot.getChildren() != null) { for (Node child : statsRoot.getChildren().values()) { @@ -175,9 +175,9 @@ private void getImmutableCacheStatsHelper(Node currentNodeInOriginalTree, Immuta } private ImmutableCacheStatsHolder.Node createMatchingImmutableCacheStatsHolderNode(Node node) { - CacheStatsSnapshot nodeSnapshot = node.getStatsSnapshot(); + ImmutableCacheStats immutableCacheStats = node.getImmutableStats(); boolean isLeafNode = node.getChildren().isEmpty(); - return new ImmutableCacheStatsHolder.Node(node.getDimensionValue(), !isLeafNode, nodeSnapshot); + return new ImmutableCacheStatsHolder.Node(node.getDimensionValue(), !isLeafNode, immutableCacheStats); } public void removeDimensions(List dimensionValues) { @@ -192,16 +192,16 @@ public void removeDimensions(List dimensionValues) { } // Returns a CacheStatsCounterSnapshot object for the stats to decrement if the removal happened, null otherwise. - private CacheStatsSnapshot removeDimensionsHelper(List dimensionValues, Node node, int depth) { + private ImmutableCacheStats removeDimensionsHelper(List dimensionValues, Node node, int depth) { if (depth == dimensionValues.size()) { // Pass up a snapshot of the original stats to avoid issues when the original is decremented by other fn invocations - return node.getStatsSnapshot(); + return node.getImmutableStats(); } Node child = node.getChild(dimensionValues.get(depth)); if (child == null) { return null; } - CacheStatsSnapshot statsToDecrement = removeDimensionsHelper(dimensionValues, child, depth + 1); + ImmutableCacheStats statsToDecrement = removeDimensionsHelper(dimensionValues, child, depth + 1); if (statsToDecrement != null) { // The removal took place, decrement values and remove this node from its parent if it's now empty node.decrementBySnapshot(statsToDecrement); @@ -281,11 +281,11 @@ long getEntries() { return this.stats.getEntries(); } - CacheStatsSnapshot getStatsSnapshot() { - return this.stats.snapshot(); + ImmutableCacheStats getImmutableStats() { + return this.stats.immutableSnapshot(); } - void decrementBySnapshot(CacheStatsSnapshot snapshot) { + void decrementBySnapshot(ImmutableCacheStats snapshot) { this.stats.subtract(snapshot); } diff --git a/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsSnapshot.java b/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStats.java similarity index 81% rename from server/src/main/java/org/opensearch/common/cache/stats/CacheStatsSnapshot.java rename to server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStats.java index 80c3b2855c0dd..7549490fd6b74 100644 --- a/server/src/main/java/org/opensearch/common/cache/stats/CacheStatsSnapshot.java +++ b/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStats.java @@ -22,14 +22,14 @@ * @opensearch.experimental */ @ExperimentalApi -public class CacheStatsSnapshot implements Writeable { // TODO: Make this extend ToXContent (in API PR) +public class ImmutableCacheStats implements Writeable { // TODO: Make this extend ToXContent (in API PR) private final long hits; private final long misses; private final long evictions; private final long sizeInBytes; private final long entries; - public CacheStatsSnapshot(long hits, long misses, long evictions, long sizeInBytes, long entries) { + public ImmutableCacheStats(long hits, long misses, long evictions, long sizeInBytes, long entries) { this.hits = hits; this.misses = misses; this.evictions = evictions; @@ -37,12 +37,12 @@ public CacheStatsSnapshot(long hits, long misses, long evictions, long sizeInByt this.entries = entries; } - public CacheStatsSnapshot(StreamInput in) throws IOException { + public ImmutableCacheStats(StreamInput in) throws IOException { this(in.readVLong(), in.readVLong(), in.readVLong(), in.readVLong(), in.readVLong()); } - public static CacheStatsSnapshot addSnapshots(CacheStatsSnapshot s1, CacheStatsSnapshot s2) { - return new CacheStatsSnapshot( + public static ImmutableCacheStats addSnapshots(ImmutableCacheStats s1, ImmutableCacheStats s2) { + return new ImmutableCacheStats( s1.hits + s2.hits, s1.misses + s2.misses, s1.evictions + s2.evictions, @@ -85,10 +85,10 @@ public boolean equals(Object o) { if (o == null) { return false; } - if (o.getClass() != CacheStatsSnapshot.class) { + if (o.getClass() != ImmutableCacheStats.class) { return false; } - CacheStatsSnapshot other = (CacheStatsSnapshot) o; + ImmutableCacheStats other = (ImmutableCacheStats) o; return (hits == other.hits) && (misses == other.misses) && (evictions == other.evictions) diff --git a/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolder.java b/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolder.java index ddcc3f2974d79..117ee06819c76 100644 --- a/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolder.java +++ b/server/src/main/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolder.java @@ -23,7 +23,7 @@ @ExperimentalApi public class ImmutableCacheStatsHolder { // TODO: extends Writeable, ToXContent - // A snapshot of a StatsHolder containing stats maintained by the cache. + // An immutable snapshot of a stats within a CacheStatsHolder, containing all the stats maintained by the cache. // Pkg-private for testing. final Node statsRoot; final List dimensionNames; @@ -33,7 +33,7 @@ public ImmutableCacheStatsHolder(Node statsRoot, List dimensionNames) { this.dimensionNames = dimensionNames; } - public CacheStatsSnapshot getTotalStats() { + public ImmutableCacheStats getTotalStats() { return statsRoot.getStats(); } @@ -57,7 +57,7 @@ public long getTotalEntries() { return getTotalStats().getEntries(); } - public CacheStatsSnapshot getStatsForDimensionValues(List dimensionValues) { + public ImmutableCacheStats getStatsForDimensionValues(List dimensionValues) { Node current = statsRoot; for (String dimensionValue : dimensionValues) { current = current.children.get(dimensionValue); @@ -75,10 +75,10 @@ static class Node { // The stats for this node. If a leaf node, corresponds to the stats for this combination of dimensions; if not, // contains the sum of its children's stats. - private CacheStatsSnapshot stats; + private ImmutableCacheStats stats; private static final Map EMPTY_CHILDREN_MAP = new HashMap<>(); - Node(String dimensionValue, boolean createChildrenMap, CacheStatsSnapshot stats) { + Node(String dimensionValue, boolean createChildrenMap, ImmutableCacheStats stats) { this.dimensionValue = dimensionValue; if (createChildrenMap) { this.children = new TreeMap<>(); // This map should be ordered to enforce a consistent order in API response @@ -92,11 +92,11 @@ Map getChildren() { return children; } - public CacheStatsSnapshot getStats() { + public ImmutableCacheStats getStats() { return stats; } - public void setStats(CacheStatsSnapshot stats) { + public void setStats(ImmutableCacheStats stats) { this.stats = stats; } diff --git a/server/src/test/java/org/opensearch/common/cache/stats/CacheStatsHolderTests.java b/server/src/test/java/org/opensearch/common/cache/stats/CacheStatsHolderTests.java index c757fa0e23fb3..390cd4d601a4b 100644 --- a/server/src/test/java/org/opensearch/common/cache/stats/CacheStatsHolderTests.java +++ b/server/src/test/java/org/opensearch/common/cache/stats/CacheStatsHolderTests.java @@ -32,12 +32,12 @@ public void testAddAndGet() throws Exception { for (List dimensionValues : expected.keySet()) { CacheStats expectedCounter = expected.get(dimensionValues); - CacheStatsSnapshot actualStatsHolder = CacheStatsHolderTests.getNode(dimensionValues, cacheStatsHolder.getStatsRoot()) - .getStatsSnapshot(); - CacheStatsSnapshot actualCacheStats = getNode(dimensionValues, cacheStatsHolder.getStatsRoot()).getStatsSnapshot(); + ImmutableCacheStats actualStatsHolder = CacheStatsHolderTests.getNode(dimensionValues, cacheStatsHolder.getStatsRoot()) + .getImmutableStats(); + ImmutableCacheStats actualCacheStats = getNode(dimensionValues, cacheStatsHolder.getStatsRoot()).getImmutableStats(); - assertEquals(expectedCounter.snapshot(), actualStatsHolder); - assertEquals(expectedCounter.snapshot(), actualCacheStats); + assertEquals(expectedCounter.immutableSnapshot(), actualStatsHolder); + assertEquals(expectedCounter.immutableSnapshot(), actualCacheStats); } // Check overall total matches @@ -45,7 +45,7 @@ public void testAddAndGet() throws Exception { for (List dims : expected.keySet()) { expectedTotal.add(expected.get(dims)); } - assertEquals(expectedTotal.snapshot(), cacheStatsHolder.getStatsRoot().getStatsSnapshot()); + assertEquals(expectedTotal.immutableSnapshot(), cacheStatsHolder.getStatsRoot().getImmutableStats()); // Check sum of children stats are correct assertSumOfChildrenStats(cacheStatsHolder.getStatsRoot()); @@ -65,8 +65,8 @@ public void testReset() throws Exception { originalCounter.entries = new CounterMetric(); CacheStatsHolder.Node node = getNode(dimensionValues, cacheStatsHolder.getStatsRoot()); - CacheStatsSnapshot actual = node.getStatsSnapshot(); - assertEquals(originalCounter.snapshot(), actual); + ImmutableCacheStats actual = node.getImmutableStats(); + assertEquals(originalCounter.immutableSnapshot(), actual); } } @@ -80,13 +80,13 @@ public void testDropStatsForDimensions() throws Exception { cacheStatsHolder.incrementHits(dims); } - assertEquals(3, cacheStatsHolder.getStatsRoot().getStatsSnapshot().getHits()); + assertEquals(3, cacheStatsHolder.getStatsRoot().getImmutableStats().getHits()); // When we invalidate A2, B2, we should lose the node for B2, but not B3 or A2. cacheStatsHolder.removeDimensions(List.of("A2", "B2")); - assertEquals(2, cacheStatsHolder.getStatsRoot().getStatsSnapshot().getHits()); + assertEquals(2, cacheStatsHolder.getStatsRoot().getImmutableStats().getHits()); assertNull(getNode(List.of("A2", "B2"), cacheStatsHolder.getStatsRoot())); assertNotNull(getNode(List.of("A2"), cacheStatsHolder.getStatsRoot())); assertNotNull(getNode(List.of("A2", "B3"), cacheStatsHolder.getStatsRoot())); @@ -95,14 +95,14 @@ public void testDropStatsForDimensions() throws Exception { cacheStatsHolder.removeDimensions(List.of("A1", "B1")); - assertEquals(1, cacheStatsHolder.getStatsRoot().getStatsSnapshot().getHits()); + assertEquals(1, cacheStatsHolder.getStatsRoot().getImmutableStats().getHits()); assertNull(getNode(List.of("A1", "B1"), cacheStatsHolder.getStatsRoot())); assertNull(getNode(List.of("A1"), cacheStatsHolder.getStatsRoot())); // When we invalidate the last node, all nodes should be deleted except the root node cacheStatsHolder.removeDimensions(List.of("A2", "B3")); - assertEquals(0, cacheStatsHolder.getStatsRoot().getStatsSnapshot().getHits()); + assertEquals(0, cacheStatsHolder.getStatsRoot().getImmutableStats().getHits()); assertEquals(0, cacheStatsHolder.getStatsRoot().children.size()); } @@ -156,12 +156,12 @@ public void testConcurrentRemoval() throws Exception { assertNull(getNode(List.of("A1"), cacheStatsHolder.getStatsRoot())); assertNotNull(getNode(List.of("A2", "B2"), cacheStatsHolder.getStatsRoot())); assertEquals( - new CacheStatsSnapshot(0, 1, 0, 0, 0), - getNode(List.of("A2", "B2"), cacheStatsHolder.getStatsRoot()).getStatsSnapshot() + new ImmutableCacheStats(0, 1, 0, 0, 0), + getNode(List.of("A2", "B2"), cacheStatsHolder.getStatsRoot()).getImmutableStats() ); assertEquals( - new CacheStatsSnapshot(1, 1, 0, 0, 0), - getNode(List.of("A2", "B3"), cacheStatsHolder.getStatsRoot()).getStatsSnapshot() + new ImmutableCacheStats(1, 1, 0, 0, 0), + getNode(List.of("A2", "B3"), cacheStatsHolder.getStatsRoot()).getImmutableStats() ); } @@ -256,9 +256,9 @@ private void assertSumOfChildrenStats(CacheStatsHolder.Node current) { if (!current.children.isEmpty()) { CacheStats expectedTotal = new CacheStats(); for (CacheStatsHolder.Node child : current.children.values()) { - expectedTotal.add(child.getStatsSnapshot()); + expectedTotal.add(child.getImmutableStats()); } - assertEquals(expectedTotal.snapshot(), current.getStatsSnapshot()); + assertEquals(expectedTotal.immutableSnapshot(), current.getImmutableStats()); for (CacheStatsHolder.Node child : current.children.values()) { assertSumOfChildrenStats(child); } diff --git a/server/src/test/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolderTests.java b/server/src/test/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolderTests.java index 2ae7434a05552..9972bb5378860 100644 --- a/server/src/test/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolderTests.java +++ b/server/src/test/java/org/opensearch/common/cache/stats/ImmutableCacheStatsHolderTests.java @@ -26,12 +26,12 @@ public void testGet() throws Exception { for (List dimensionValues : expected.keySet()) { CacheStats expectedCounter = expected.get(dimensionValues); - CacheStatsSnapshot actualStatsHolder = CacheStatsHolderTests.getNode(dimensionValues, cacheStatsHolder.getStatsRoot()) - .getStatsSnapshot(); - CacheStatsSnapshot actualCacheStats = getNode(dimensionValues, stats.getStatsRoot()).getStats(); + ImmutableCacheStats actualStatsHolder = CacheStatsHolderTests.getNode(dimensionValues, cacheStatsHolder.getStatsRoot()) + .getImmutableStats(); + ImmutableCacheStats actualCacheStats = getNode(dimensionValues, stats.getStatsRoot()).getStats(); - assertEquals(expectedCounter.snapshot(), actualStatsHolder); - assertEquals(expectedCounter.snapshot(), actualCacheStats); + assertEquals(expectedCounter.immutableSnapshot(), actualStatsHolder); + assertEquals(expectedCounter.immutableSnapshot(), actualCacheStats); } // test gets for total (this also checks sum-of-children logic) @@ -39,7 +39,7 @@ public void testGet() throws Exception { for (List dims : expected.keySet()) { expectedTotal.add(expected.get(dims)); } - assertEquals(expectedTotal.snapshot(), stats.getTotalStats()); + assertEquals(expectedTotal.immutableSnapshot(), stats.getTotalStats()); assertEquals(expectedTotal.getHits(), stats.getTotalHits()); assertEquals(expectedTotal.getMisses(), stats.getTotalMisses()); @@ -79,7 +79,7 @@ private void assertSumOfChildrenStats(ImmutableCacheStatsHolder.Node current) { for (ImmutableCacheStatsHolder.Node child : current.children.values()) { expectedTotal.add(child.getStats()); } - assertEquals(expectedTotal.snapshot(), current.getStats()); + assertEquals(expectedTotal.immutableSnapshot(), current.getStats()); for (ImmutableCacheStatsHolder.Node child : current.children.values()) { assertSumOfChildrenStats(child); } diff --git a/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java b/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java index 72b3c2c5bc7df..008dc7c2e0902 100644 --- a/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java +++ b/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java @@ -15,7 +15,7 @@ import org.opensearch.common.cache.LoadAwareCacheLoader; import org.opensearch.common.cache.RemovalListener; import org.opensearch.common.cache.RemovalNotification; -import org.opensearch.common.cache.stats.CacheStatsSnapshot; +import org.opensearch.common.cache.stats.ImmutableCacheStats; import org.opensearch.common.cache.store.config.CacheConfig; import org.opensearch.common.cache.store.settings.OpenSearchOnHeapCacheSettings; import org.opensearch.common.metrics.CounterMetric; @@ -114,7 +114,7 @@ public void testInvalidateWithDropDimensions() throws Exception { ICacheKey keyToDrop = keysAdded.get(0); - CacheStatsSnapshot snapshot = cache.stats().getStatsForDimensionValues(keyToDrop.dimensions); + ImmutableCacheStats snapshot = cache.stats().getStatsForDimensionValues(keyToDrop.dimensions); assertNotNull(snapshot); keyToDrop.setDropStatsForDimensions(true); diff --git a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java index 8f46902051740..e3dca1b7bfda2 100644 --- a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java +++ b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java @@ -52,7 +52,7 @@ import org.opensearch.common.cache.RemovalReason; import org.opensearch.common.cache.module.CacheModule; import org.opensearch.common.cache.service.CacheService; -import org.opensearch.common.cache.stats.CacheStatsSnapshot; +import org.opensearch.common.cache.stats.ImmutableCacheStats; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.lucene.index.OpenSearchDirectoryReader; import org.opensearch.common.settings.Settings; @@ -804,9 +804,7 @@ public void testClosingIndexWipesStats() throws Exception { } ThreadPool threadPool = getThreadPool(); Settings settings = Settings.builder().put(INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING.getKey(), "0.001%").build(); - IndicesRequestCache cache = new IndicesRequestCache( - settings, - (shardId -> { + IndicesRequestCache cache = new IndicesRequestCache(settings, (shardId -> { IndexService indexService = null; try { indexService = indicesService.indexServiceSafe(shardId.getIndex()); @@ -818,7 +816,7 @@ public void testClosingIndexWipesStats() throws Exception { } catch (ShardNotFoundException ex) { return Optional.empty(); } - }), + }), new CacheModule(new ArrayList<>(), Settings.EMPTY).getCacheService(), threadPool, ClusterServiceUtils.createClusterService(threadPool) @@ -862,7 +860,7 @@ public void testClosingIndexWipesStats() throws Exception { ShardId shardId = indexService.getShard(i).shardId(); List dimensionValues = List.of(shardId.getIndexName(), shardId.toString()); initialDimensionValues.add(dimensionValues); - CacheStatsSnapshot snapshot = cache.stats().getStatsForDimensionValues(dimensionValues); + ImmutableCacheStats snapshot = cache.stats().getStatsForDimensionValues(dimensionValues); assertNotNull(snapshot); // check the values are not empty by confirming entries != 0, this should always be true since the missed value is loaded // into the cache @@ -883,7 +881,7 @@ public void testClosingIndexWipesStats() throws Exception { // Now stats for the closed index should be gone for (List dimensionValues : initialDimensionValues) { - CacheStatsSnapshot snapshot = cache.stats().getStatsForDimensionValues(dimensionValues); + ImmutableCacheStats snapshot = cache.stats().getStatsForDimensionValues(dimensionValues); if (dimensionValues.get(0).equals(indexToCloseName)) { assertNull(snapshot); } else {