You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by da...@apache.org on 2026/04/13 15:04:17 UTC

(jackrabbit-oak) branch OAK-12155 created (now fb4c4b1c7e)

This is an automated email from the ASF dual-hosted git repository.

daim pushed a change to branch OAK-12155
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at fb4c4b1c7e OAK-12155 : removed guava cache from oak-store-document diff caches

This branch includes the following new commits:

     new fb4c4b1c7e OAK-12155 : removed guava cache from oak-store-document diff caches

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(jackrabbit-oak) 01/01: OAK-12155 : removed guava cache from oak-store-document diff caches

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch OAK-12155
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit fb4c4b1c7e85c127d748dbb43cef5d4ce604c4a7
Author: rishabhdaim <ri...@gmail.com>
AuthorDate: Mon Apr 13 20:34:02 2026 +0530

    OAK-12155 : removed guava cache from oak-store-document diff caches
---
 .../jackrabbit/oak/plugins/document/DiffCache.java |  4 +--
 .../oak/plugins/document/DocumentNodeStore.java    |  3 +-
 .../plugins/document/DocumentNodeStoreBuilder.java | 22 +++++++++----
 .../plugins/document/DocumentNodeStoreService.java |  5 +--
 .../oak/plugins/document/JournalDiffLoader.java    |  4 +--
 .../oak/plugins/document/LocalDiffCache.java       | 13 ++++----
 .../oak/plugins/document/MemoryDiffCache.java      | 37 +++++++++-------------
 .../oak/plugins/document/TieredDiffCache.java      | 13 ++++----
 .../oak/plugins/document/AmnesiaDiffCache.java     |  4 +--
 .../document/DocumentNodeStoreDiffTest.java        |  8 ++---
 .../plugins/document/JournalDiffLoaderTest.java    |  8 ++---
 .../oak/plugins/document/LocalDiffCacheTest.java   | 16 +++++-----
 .../oak/plugins/document/MemoryDiffCacheTest.java  |  4 +--
 .../oak/plugins/document/NodeStoreDiffTest.java    |  4 +--
 .../oak/plugins/document/TieredDiffCacheTest.java  |  4 +--
 15 files changed, 77 insertions(+), 72 deletions(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
index c3128cc273..4b4de76757 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.oak.plugins.document;
 
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.commons.json.JsopReader;
 import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
 import org.jetbrains.annotations.NotNull;
@@ -69,7 +69,7 @@ abstract class DiffCache {
      * @return the statistics for this cache.
      */
     @NotNull
-    abstract Iterable<CacheStats> getStats();
+    abstract Iterable<AbstractCacheStats> getStats();
 
     /**
      * Invalidates all the entries in the cache.
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
index ef537564dd..2312b52451 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
@@ -78,6 +78,7 @@ import org.apache.jackrabbit.guava.common.cache.Cache;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.cache.CacheStats;
 import org.apache.jackrabbit.oak.commons.PerfLogger;
 import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
@@ -1305,7 +1306,7 @@ public final class DocumentNodeStore
     }
 
     @NotNull
-    public Iterable<CacheStats> getDiffCacheStats() {
+    public Iterable<AbstractCacheStats> getDiffCacheStats() {
         return diffCache.getStats();
     }
 
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
index 88f401c370..3f5581a4cf 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
@@ -987,12 +987,22 @@ public class DocumentNodeStoreBuilder<T extends DocumentNodeStoreBuilder<T>> {
         return buildCache(CacheType.CHILDREN, getChildrenCacheSize(), store, null);
     }
 
-    public Cache<CacheValue, StringValue> buildMemoryDiffCache() {
-        return buildCache(CacheType.DIFF, getMemoryDiffCacheSize(), null, null);
-    }
-
-    public Cache<RevisionsKey, LocalDiffCache.Diff> buildLocalDiffCache() {
-        return buildCache(CacheType.LOCAL_DIFF, getLocalDiffCacheSize(), null, null);
+    public org.apache.jackrabbit.oak.cache.api.Cache<CacheValue, StringValue> buildMemoryDiffCache() {
+        return org.apache.jackrabbit.oak.cache.api.CacheBuilder
+                .<CacheValue, StringValue>newBuilder()
+                .maximumWeight(getMemoryDiffCacheSize())
+                .weigher((k, v) -> weigher.weigh(k, v))
+                .recordStats()
+                .build();
+    }
+
+    public org.apache.jackrabbit.oak.cache.api.Cache<RevisionsKey, LocalDiffCache.Diff> buildLocalDiffCache() {
+        return org.apache.jackrabbit.oak.cache.api.CacheBuilder
+                .<RevisionsKey, LocalDiffCache.Diff>newBuilder()
+                .maximumWeight(getLocalDiffCacheSize())
+                .weigher((k, v) -> weigher.weigh(k, v))
+                .recordStats()
+                .build();
     }
 
     public Cache<CacheValue, NodeDocument> buildDocumentCache(DocumentStore docStore) {
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
index a651a53a7f..6e9f95ecd2 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
@@ -59,6 +59,7 @@ import org.apache.jackrabbit.oak.api.Descriptors;
 import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean;
 import org.apache.jackrabbit.oak.api.jmx.CheckpointMBean;
 import org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.cache.CacheStats;
 import org.apache.jackrabbit.oak.commons.pio.Closer;
 import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCStats;
@@ -873,7 +874,7 @@ public class DocumentNodeStoreService {
             IOException {
         registerCacheStatsMBean(store.getNodeCacheStats());
         registerCacheStatsMBean(store.getNodeChildrenCacheStats());
-        for (CacheStats cs : store.getDiffCacheStats()) {
+        for (AbstractCacheStats cs : store.getDiffCacheStats()) {
             registerCacheStatsMBean(cs);
         }
         DocumentStore ds = store.getDocumentStore();
@@ -968,7 +969,7 @@ public class DocumentNodeStoreService {
         }
     }
 
-    private void registerCacheStatsMBean(CacheStats cacheStats) {
+    private void registerCacheStatsMBean(AbstractCacheStats cacheStats) {
         addRegistration(registerMBean(whiteboard, CacheStatsMBean.class,
                 cacheStats, CacheStatsMBean.TYPE, cacheStats.getName()));
     }
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoader.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoader.java
index 3667f40ce2..2da34f667d 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoader.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoader.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.commons.sort.StringSort;
 import org.apache.jackrabbit.oak.commons.time.Stopwatch;
 import org.apache.jackrabbit.oak.plugins.document.util.StringValue;
@@ -298,7 +298,7 @@ class JournalDiffLoader implements DiffCache.Loader {
 
         @NotNull
         @Override
-        Iterable<CacheStats> getStats() {
+        Iterable<AbstractCacheStats> getStats() {
             return cache.getStats();
         }
 
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCache.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCache.java
index b9adddd66b..da42b338ef 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCache.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCache.java
@@ -20,9 +20,10 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.jackrabbit.guava.common.cache.Cache;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.cache.CacheValue;
+import org.apache.jackrabbit.oak.cache.api.Cache;
+import org.apache.jackrabbit.oak.cache.api.CacheStatsAdapter;
 import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
 import org.apache.jackrabbit.oak.commons.json.JsopReader;
 import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
@@ -45,13 +46,13 @@ public class LocalDiffCache extends DiffCache {
     private static int MAX_ENTRY_SIZE = 16 * 1024 * 1024;
 
     private final Cache<RevisionsKey, Diff> diffCache;
-    private final CacheStats diffCacheStats;
+    private final AbstractCacheStats diffCacheStats;
 
     LocalDiffCache(DocumentNodeStoreBuilder<?> builder) {
         this.diffCache = builder.buildLocalDiffCache();
-        this.diffCacheStats = new CacheStats(diffCache,
+        this.diffCacheStats = new CacheStatsAdapter(diffCache,
                 "Document-LocalDiff",
-                builder.getWeigher(), builder.getLocalDiffCacheSize());
+                (k, v) -> builder.getWeigher().weigh(k, v), builder.getLocalDiffCacheSize());
     }
 
     @Override
@@ -107,7 +108,7 @@ public class LocalDiffCache extends DiffCache {
 
     @NotNull
     @Override
-    public Iterable<CacheStats> getStats() {
+    public Iterable<AbstractCacheStats> getStats() {
         return Collections.singleton(diffCacheStats);
     }
 
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCache.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCache.java
index 251c931d61..8f27d8164c 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCache.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCache.java
@@ -17,12 +17,11 @@
 package org.apache.jackrabbit.oak.plugins.document;
 
 import java.util.Collections;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
 
-import org.apache.jackrabbit.guava.common.cache.Cache;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.cache.CacheValue;
+import org.apache.jackrabbit.oak.cache.api.Cache;
+import org.apache.jackrabbit.oak.cache.api.CacheStatsAdapter;
 import org.apache.jackrabbit.oak.plugins.document.util.StringValue;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -52,13 +51,13 @@ public class MemoryDiffCache extends DiffCache {
      * Key: PathRev, value: StringValue
      */
     protected final Cache<CacheValue, StringValue> diffCache;
-    protected final CacheStats diffCacheStats;
+    protected final AbstractCacheStats diffCacheStats;
 
 
     protected MemoryDiffCache(DocumentNodeStoreBuilder<?> builder) {
         diffCache = builder.buildMemoryDiffCache();
-        diffCacheStats = new CacheStats(diffCache, "Document-MemoryDiff",
-                builder.getWeigher(), builder.getMemoryDiffCacheSize());
+        diffCacheStats = new CacheStatsAdapter(diffCache, "Document-MemoryDiff",
+                (k, v) -> builder.getWeigher().weigh(k, v), builder.getMemoryDiffCacheSize());
     }
 
     @Nullable
@@ -75,20 +74,14 @@ public class MemoryDiffCache extends DiffCache {
                 diff = StringValue.EMPTY;
             }
         } else {
-            try {
-                diff = diffCache.get(key, new Callable<StringValue>() {
-                    @Override
-                    public StringValue call() throws Exception {
-                        if (isUnchanged(from, to, path)) {
-                            return StringValue.EMPTY;
-                        } else {
-                            return new StringValue(loader.call());
-                        }
-                    }
-                });
-            } catch (ExecutionException e) {
-                // try again with loader directly
-                diff = new StringValue(loader.call());
+            diff = diffCache.getIfPresent(key);
+            if (diff == null) {
+                // Caffeine's get(key, fn) holds a CHM compute lock for the entire
+                // mapping function. loader.call() can re-enter getChanges() on this
+                // same cache, which causes "Recursive update". Compute the value
+                // outside any lock and use putIfAbsent so the first writer wins.
+                diff = isUnchanged(from, to, path) ? StringValue.EMPTY : new StringValue(loader.call());
+                diffCache.asMap().putIfAbsent(key, diff);
             }
         }
         return diff != null ? diff.toString() : null;
@@ -104,7 +97,7 @@ public class MemoryDiffCache extends DiffCache {
 
     @NotNull
     @Override
-    public Iterable<CacheStats> getStats() {
+    public Iterable<AbstractCacheStats> getStats() {
         return Collections.singleton(diffCacheStats);
     }
 
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
index 6da5c935c0..1d817b7a46 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
@@ -16,10 +16,9 @@
  */
 package org.apache.jackrabbit.oak.plugins.document;
 
-import org.apache.jackrabbit.guava.common.cache.Cache;
-import org.apache.jackrabbit.guava.common.cache.CacheBuilder;
-
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
+import org.apache.jackrabbit.oak.cache.api.Cache;
+import org.apache.jackrabbit.oak.cache.api.CacheBuilder;
 import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
 import org.apache.jackrabbit.oak.plugins.document.util.RevisionsKey;
 import org.jetbrains.annotations.NotNull;
@@ -37,8 +36,8 @@ class TieredDiffCache extends DiffCache {
      * A small cache of local diff cache misses to prevent repeated calls with
      * the same revision vector range.
      */
-    private Cache<RevisionsKey, RevisionsKey> localDiffMisses
-            = CacheBuilder.newBuilder().maximumSize(128).build();
+    private final Cache<RevisionsKey, RevisionsKey> localDiffMisses
+            = CacheBuilder.<RevisionsKey, RevisionsKey>newBuilder().maximumSize(128).build();
 
     private final int clusterId;
     private final DiffCache localCache;
@@ -94,7 +93,7 @@ class TieredDiffCache extends DiffCache {
 
     @NotNull
     @Override
-    public Iterable<CacheStats> getStats() {
+    public Iterable<AbstractCacheStats> getStats() {
         return IterableUtils.chainedIterable(localCache.getStats(), memoryCache.getStats());
     }
 
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
index 14f18f395a..2d69c7fb79 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.plugins.document;
 
 import java.util.Collections;
 
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -61,7 +61,7 @@ class AmnesiaDiffCache extends DiffCache {
 
     @NotNull
     @Override
-    public Iterable<CacheStats> getStats() {
+    public Iterable<AbstractCacheStats> getStats() {
         return Collections.emptyList();
     }
 
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreDiffTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreDiffTest.java
index e90dcb221a..527239c9c4 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreDiffTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreDiffTest.java
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.oak.plugins.document;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
@@ -63,14 +63,14 @@ public class DocumentNodeStoreDiffTest extends AbstractMongoConnectionTest {
             merge(store, builder);
         }
 
-        Iterable<CacheStats> stats = store.getDiffCacheStats();
-        for (CacheStats cs : stats) {
+        Iterable<AbstractCacheStats> stats = store.getDiffCacheStats();
+        for (AbstractCacheStats cs : stats) {
             cs.resetStats();
         }
 
         // must not cause cache misses
         Diff.perform(before, after);
-        for (CacheStats cs : stats) {
+        for (AbstractCacheStats cs : stats) {
             assertEquals(0, cs.getMissCount());
         }
     }
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java
index fa86f925c2..107b9ba6a5 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoaderTest.java
@@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
@@ -217,7 +217,7 @@ public class JournalDiffLoaderTest {
         ns.runBackgroundOperations();
         DocumentNodeState after = (DocumentNodeState) ns.getRoot().getChildNode("foo");
 
-        CacheStats cs = getMemoryDiffStats(ns);
+        AbstractCacheStats cs = getMemoryDiffStats(ns);
         assertNotNull(cs);
         cs.resetStats();
         Set<String> changes = changeChildNodes(ns, before, after);
@@ -362,8 +362,8 @@ public class JournalDiffLoaderTest {
         assertEquals(0, store.getNumFindCalls(Collection.JOURNAL));
     }
 
-    private static CacheStats getMemoryDiffStats(DocumentNodeStore ns) {
-        for (CacheStats cs : ns.getDiffCache().getStats()) {
+    private static AbstractCacheStats getMemoryDiffStats(DocumentNodeStore ns) {
+        for (AbstractCacheStats cs : ns.getDiffCache().getStats()) {
             if (cs.getName().equals("Document-MemoryDiff")) {
                 return cs;
             }
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
index 38ddb3040f..6bf7c3bd43 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
@@ -22,7 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.plugins.document.LocalDiffCache.Diff;
 import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
@@ -56,7 +56,7 @@ public class LocalDiffCacheTest {
         o.reset();
 
         DiffCache cache = store.getDiffCache();
-        Iterable<CacheStats> stats = cache.getStats();
+        Iterable<AbstractCacheStats> stats = cache.getStats();
 
         NodeBuilder builder = store.getRoot().builder();
         builder.child("a").child("a2").setProperty("foo", "bar");
@@ -118,24 +118,24 @@ public class LocalDiffCacheTest {
                 .open();
     }
 
-    private static long getHitCount(Iterable<CacheStats> stats) {
+    private static long getHitCount(Iterable<AbstractCacheStats> stats) {
         long hitCount = 0;
-        for (CacheStats cs : stats) {
+        for (AbstractCacheStats cs : stats) {
             hitCount += cs.getHitCount();
         }
         return hitCount;
     }
 
-    private static long getMissCount(Iterable<CacheStats> stats) {
+    private static long getMissCount(Iterable<AbstractCacheStats> stats) {
         long missCount = 0;
-        for (CacheStats cs : stats) {
+        for (AbstractCacheStats cs : stats) {
             missCount += cs.getMissCount();
         }
         return missCount;
     }
 
-    private static void resetStats(Iterable<CacheStats> stats) {
-        for (CacheStats cs : stats) {
+    private static void resetStats(Iterable<AbstractCacheStats> stats) {
+        for (AbstractCacheStats cs : stats) {
             cs.resetStats();
         }
     }
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheTest.java
index a96980e08d..d37ae5a3cb 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheTest.java
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.plugins.document;
 
 import java.util.UUID;
 
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -68,7 +68,7 @@ public class MemoryDiffCacheTest {
         DiffCache cache = new MemoryDiffCache(builderProvider.newBuilder()
                 .setCacheSegmentCount(1)
                 .memoryCacheDistribution(0, 0, 0, 99, 0));
-        Iterable<CacheStats> statsIterable = cache.getStats();
+        Iterable<AbstractCacheStats> statsIterable = cache.getStats();
         assertNotNull(statsIterable);
         assertTrue(statsIterable.iterator().hasNext());
     }
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
index c30cde3396..3e6f1e4e06 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
@@ -25,7 +25,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandler;
 import org.apache.jackrabbit.oak.plugins.commit.ConflictHook;
@@ -228,7 +228,7 @@ public class NodeStoreDiffTest {
 
     private long diffCacheRequests(DocumentNodeStore ns) {
         long num = 0;
-        for (CacheStats stats : ns.getDiffCacheStats()) {
+        for (AbstractCacheStats stats : ns.getDiffCacheStats()) {
             num += stats.getRequestCount();
         }
         return num;
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCacheTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCacheTest.java
index 0923ca8750..cbb2e1ae94 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCacheTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCacheTest.java
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.plugins.document;
 
 import java.lang.reflect.Field;
 
-import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -88,7 +88,7 @@ public class TieredDiffCacheTest {
     @Test
     public void getStatsReturnsNonEmptyIterable() {
         TieredDiffCache cache = buildCache();
-        Iterable<CacheStats> stats = cache.getStats();
+        Iterable<AbstractCacheStats> stats = cache.getStats();
         assertNotNull(stats);
         assertTrue(stats.iterator().hasNext());
     }