VladRodionov commented on code in PR #8653:
URL: https://github.com/apache/hbase/pull/8653#discussion_r4068438869


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/LruCacheEngine.java:
##########
@@ -0,0 +1,1623 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.io.hfile.cache;
+
+import java.lang.ref.WeakReference;
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.PriorityQueue;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.concurrent.locks.ReentrantLock;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseInterfaceAudience;
+import org.apache.hadoop.hbase.io.HeapSize;
+import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
+import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
+import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil;
+import org.apache.hadoop.hbase.io.hfile.BlockPriority;
+import org.apache.hadoop.hbase.io.hfile.BlockType;
+import org.apache.hadoop.hbase.io.hfile.CacheStats;
+import org.apache.hadoop.hbase.io.hfile.Cacheable;
+import org.apache.hadoop.hbase.io.hfile.CachedBlock;
+import org.apache.hadoop.hbase.io.hfile.HFileBlock;
+import org.apache.hadoop.hbase.io.hfile.LruCachedBlock;
+import org.apache.hadoop.hbase.io.hfile.LruCachedBlockQueue;
+import org.apache.hadoop.hbase.util.ClassSize;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hbase.thirdparty.com.google.common.base.MoreObjects;
+import org.apache.hbase.thirdparty.com.google.common.base.Objects;
+import 
org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+/**
+ * Native LRU {@link CacheEngine} implementation.
+ * <p>
+ * This cache is memory-aware using {@link HeapSize}, memory-bound using an 
LRU eviction algorithm,
+ * and concurrent. It is backed by a {@link ConcurrentHashMap} and can use a 
non-blocking eviction
+ * thread, providing constant-time {@link #cacheBlock(BlockCacheKey, 
Cacheable, boolean)} and
+ * {@link #getBlock(BlockCacheKey, boolean, boolean, boolean)} operations.
+ * </p>
+ * <p>
+ * The cache maintains three block-priority levels to provide scan resistance 
and support in-memory
+ * column families:
+ * </p>
+ * <ul>
+ * <li>single-access blocks</li>
+ * <li>multiple-access blocks</li>
+ * <li>in-memory blocks</li>
+ * </ul>
+ * <p>
+ * Each priority is assigned a portion of the total cache capacity. During 
eviction the cache tries
+ * to preserve the configured relative sizes while allowing unused capacity in 
one priority to be
+ * consumed by another.
+ * </p>
+ * <p>
+ * This class is a storage engine only. It does not perform L1/L2 
orchestration, victim-cache
+ * delegation, tier placement, admission control, promotion, or demotion. 
Those responsibilities
+ * belong to the cache topology and policy layers.
+ * </p>
+ */
[email protected]
+public class LruCacheEngine implements CacheEngine, HeapSize, 
Iterable<CachedBlock> {

Review Comment:
   All block caches as well as BlockCache interface will be retired.  The 
reason why some of them seem so similar is because they have to, with some 
future exceptions, such as BucketCache (BucketCacheEngine will contains core of 
BucketCache less orchestration/placement logic), TinyLFUBlockCache and 
AdaptiveLRUBlockCache will be gone completely and replaced by corresponding 
implementations of CacheAdmissionPlacementPolicy and this policies can be used 
with any types of CacheEngine giving them new functionality.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to