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

kturner pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new 2b8fc0c488 deprecates lru block cache and makes TinyLfu the new 
default (#4920)
2b8fc0c488 is described below

commit 2b8fc0c488504f257405b4708bf5e96624678410
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Mon Sep 23 13:22:36 2024 -0400

    deprecates lru block cache and makes TinyLfu the new default (#4920)
    
    If the TinyLfu cache works well as the default going forward then the
    LRU cache could eventually be dropped.
---
 core/src/main/java/org/apache/accumulo/core/conf/Property.java |  8 +++-----
 .../core/file/blockfile/cache/lru/LruBlockCacheManager.java    |  2 ++
 .../core/file/blockfile/cache/BlockCacheFactoryTest.java       |  1 +
 .../accumulo/core/file/blockfile/cache/TestLruBlockCache.java  |  1 +
 .../org/apache/accumulo/core/file/rfile/AbstractRFileTest.java | 10 +++++-----
 .../java/org/apache/accumulo/core/file/rfile/RFileTest.java    |  4 ++--
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java 
b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 88975feb2c..eb2ffbfd6d 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -30,6 +30,7 @@ import java.util.function.Predicate;
 
 import org.apache.accumulo.core.classloader.ClassLoaderUtil;
 import org.apache.accumulo.core.data.constraints.NoDeleteConstraint;
+import 
org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheManager;
 import org.apache.accumulo.core.file.rfile.RFile;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 import org.apache.accumulo.core.iteratorsImpl.system.DeletingIterator;
@@ -504,11 +505,8 @@ public enum Property {
       "Time to wait for clients to continue scans before closing a session.", 
"1.3.5"),
   TSERV_DEFAULT_BLOCKSIZE("tserver.default.blocksize", "1M", 
PropertyType.BYTES,
       "Specifies a default blocksize for the tserver caches.", "1.3.5"),
-  TSERV_CACHE_MANAGER_IMPL("tserver.cache.manager.class",
-      
"org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheManager", 
PropertyType.STRING,
-      "Specifies the class name of the block cache factory implementation."
-          + " Alternative implementation is"
-          + " 
org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheManager.",
+  TSERV_CACHE_MANAGER_IMPL("tserver.cache.manager.class", 
TinyLfuBlockCacheManager.class.getName(),
+      PropertyType.STRING, "Specifies the class name of the block cache 
factory implementation.",
       "2.0.0"),
   TSERV_DATACACHE_SIZE("tserver.cache.data.size", "10%", PropertyType.MEMORY,
       "Specifies the size of the cache for RFile data blocks.", "1.3.5"),
diff --git 
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheManager.java
 
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheManager.java
index a4132b7d75..76be394e3b 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheManager.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheManager.java
@@ -24,6 +24,7 @@ import org.apache.accumulo.core.spi.cache.CacheType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Deprecated(since = "3.1.0")
 public class LruBlockCacheManager extends BlockCacheManager {
 
   private static final Logger LOG = 
LoggerFactory.getLogger(LruBlockCacheManager.class);
@@ -32,6 +33,7 @@ public class LruBlockCacheManager extends BlockCacheManager {
   protected BlockCache createCache(Configuration conf, CacheType type) {
     LruBlockCacheConfiguration cc = new LruBlockCacheConfiguration(conf, type);
     LOG.info("Creating {} cache with configuration {}", type, cc);
+    LOG.warn("This cache implementation is deprecated and will be remove in 
future releases.");
     return new LruBlockCache(cc);
   }
 
diff --git 
a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
 
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
index 1cbfbd289f..8338d2735a 100644
--- 
a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
@@ -34,6 +34,7 @@ import org.junit.jupiter.api.Test;
 public class BlockCacheFactoryTest {
 
   @Test
+  @SuppressWarnings("deprecation")
   public void testCreateLruBlockCacheFactory() throws Exception {
     DefaultConfiguration dc = DefaultConfiguration.getInstance();
     ConfigurationCopy cc = new ConfigurationCopy(dc);
diff --git 
a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
 
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
index bf814e0e4d..e12dacfe71 100644
--- 
a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
@@ -49,6 +49,7 @@ import org.junit.jupiter.api.Test;
  * Tests will ensure it grows and shrinks in size properly, evictions run when 
they're supposed to
  * and do what they should, and that cached blocks are accessible when 
expected to be.
  */
+@SuppressWarnings("deprecation")
 public class TestLruBlockCache {
 
   @Test
diff --git 
a/core/src/test/java/org/apache/accumulo/core/file/rfile/AbstractRFileTest.java 
b/core/src/test/java/org/apache/accumulo/core/file/rfile/AbstractRFileTest.java
index a5fc04a854..d65991590a 100644
--- 
a/core/src/test/java/org/apache/accumulo/core/file/rfile/AbstractRFileTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/file/rfile/AbstractRFileTest.java
@@ -44,8 +44,7 @@ import org.apache.accumulo.core.dataImpl.KeyExtent;
 import org.apache.accumulo.core.file.FileSKVIterator;
 import 
org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheConfiguration;
 import 
org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheManagerFactory;
-import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCache;
-import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheManager;
+import 
org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.impl.BasicCacheProvider;
 import 
org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile.CachableBuilder;
 import org.apache.accumulo.core.file.rfile.RFile.FencedReader;
@@ -56,6 +55,7 @@ import 
org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import 
org.apache.accumulo.core.iteratorsImpl.system.ColumnFamilySkippingIterator;
 import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
 import org.apache.accumulo.core.sample.impl.SamplerFactory;
+import org.apache.accumulo.core.spi.cache.BlockCache;
 import org.apache.accumulo.core.spi.cache.BlockCacheManager;
 import org.apache.accumulo.core.spi.cache.CacheType;
 import org.apache.accumulo.core.spi.crypto.CryptoEnvironment;
@@ -164,7 +164,7 @@ public abstract class AbstractRFileTest {
 
       DefaultConfiguration dc = DefaultConfiguration.getInstance();
       ConfigurationCopy cc = new ConfigurationCopy(dc);
-      cc.set(Property.TSERV_CACHE_MANAGER_IMPL, 
LruBlockCacheManager.class.getName());
+      cc.set(Property.TSERV_CACHE_MANAGER_IMPL, 
TinyLfuBlockCacheManager.class.getName());
       try {
         manager = BlockCacheManagerFactory.getInstance(cc);
       } catch (ReflectiveOperationException e) {
@@ -174,8 +174,8 @@ public abstract class AbstractRFileTest {
       cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000));
       cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000));
       manager.start(BlockCacheConfiguration.forTabletServer(cc));
-      LruBlockCache indexCache = (LruBlockCache) 
manager.getBlockCache(CacheType.INDEX);
-      LruBlockCache dataCache = (LruBlockCache) 
manager.getBlockCache(CacheType.DATA);
+      BlockCache indexCache = manager.getBlockCache(CacheType.INDEX);
+      BlockCache dataCache = manager.getBlockCache(CacheType.DATA);
 
       CryptoService cs = 
CryptoFactoryLoader.getServiceForClient(CryptoEnvironment.Scope.TABLE,
           accumuloConfiguration.getAllCryptoProperties());
diff --git 
a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java 
b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index 36533596dc..81c76d58ff 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -64,7 +64,7 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileSKVIterator;
 import 
org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheConfiguration;
 import 
org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheManagerFactory;
-import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheManager;
+import 
org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.impl.BasicCacheProvider;
 import 
org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile.CachableBuilder;
 import org.apache.accumulo.core.file.rfile.RFile.Reader;
@@ -1584,7 +1584,7 @@ public class RFileTest extends AbstractRFileTest {
     byte[] data = baos.toByteArray();
     SeekableByteArrayInputStream bais = new SeekableByteArrayInputStream(data);
     FSDataInputStream in2 = new FSDataInputStream(bais);
-    aconf.set(Property.TSERV_CACHE_MANAGER_IMPL, 
LruBlockCacheManager.class.getName());
+    aconf.set(Property.TSERV_CACHE_MANAGER_IMPL, 
TinyLfuBlockCacheManager.class.getName());
     aconf.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(100000));
     aconf.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000));
     aconf.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000));

Reply via email to