This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 0b0d0d39a415decae13099cd68beac85ef30109d Merge: 8f18d29f32 9edd74bb06 Author: Keith Turner <ktur...@apache.org> AuthorDate: Wed May 22 10:49:34 2024 -0400 Merge branch 'main' into elasticity .../accumulo/core/file/blockfile/cache/lru/LruBlockCache.java | 10 +++++----- .../file/blockfile/cache/lru/LruBlockCacheConfiguration.java | 4 ++++ .../core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java index ab86ac1a58,7ee9dadbf8..2baba46caf --- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java +++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java @@@ -64,14 -63,15 +64,15 @@@ public final class TinyLfuBlockCache im private final int maxSize; private final ScheduledExecutorService statsExecutor = ThreadPools.getServerThreadPools() .createScheduledExecutorService(1, "TinyLfuBlockCacheStatsExecutor"); + private final CacheType type; public TinyLfuBlockCache(Configuration conf, CacheType type) { - cache = Caffeine.newBuilder() + cache = Caches.getInstance().createNewBuilder(CacheName.TINYLFU_BLOCK_CACHE, false) .initialCapacity((int) Math.ceil(1.2 * conf.getMaxSize(type) / conf.getBlockSize())) - .weigher((String blockName, Block block) -> { + .recordStats().weigher((String blockName, Block block) -> { int keyWeight = ClassSize.align(blockName.length()) + ClassSize.STRING; return keyWeight + block.weight(); - }).maximumWeight(conf.getMaxSize(type)).recordStats().build(); + }).maximumWeight(conf.getMaxSize(type)).build(); policy = cache.policy().eviction().orElseThrow(); maxSize = (int) Math.min(Integer.MAX_VALUE, policy.getMaximum()); ScheduledFuture<?> future = statsExecutor.scheduleAtFixedRate(this::logStats, STATS_PERIOD_SEC,