You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by re...@apache.org on 2021/07/23 02:38:38 UTC
[hbase] branch branch-1 updated: HBASE-26094 L2 BC should not be
the victimhandler of L1 BC when using combined BC (#3498)
This is an automated email from the ASF dual-hosted git repository.
reidchan pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new dbeabba HBASE-26094 L2 BC should not be the victimhandler of L1 BC when using combined BC (#3498)
dbeabba is described below
commit dbeabbac97cbea31fdbf236036c0355d053c2bac
Author: YutSean <yu...@gmail.com>
AuthorDate: Fri Jul 23 10:38:11 2021 +0800
HBASE-26094 L2 BC should not be the victimhandler of L1 BC when using combined BC (#3498)
Signed-off-by: Reid Chan <re...@apache.org>
---
.../src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java | 2 +-
.../main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java | 2 --
.../org/apache/hadoop/hbase/io/hfile/InclusiveCombinedBlockCache.java | 1 +
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
index 4876fab..6efa9db 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
@@ -783,9 +783,9 @@ public class CacheConfig {
// background eviction thread runs, blocks evicted from L1 will go to L2 AND when we get
// a block from the L1 cache, if not in L1, we will search L2.
GLOBAL_BLOCK_CACHE_INSTANCE = l1;
+ l1.setVictimCache(l2);
}
}
- l1.setVictimCache(l2);
}
return GLOBAL_BLOCK_CACHE_INSTANCE;
}
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java
index 015ab05..562e874 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java
@@ -77,8 +77,6 @@ public class CombinedBlockCache implements ResizableBlockCache, HeapSize {
@Override
public Cacheable getBlock(BlockCacheKey cacheKey, boolean caching,
boolean repeat, boolean updateCacheMetrics) {
- // TODO: is there a hole here, or just awkwardness since in the lruCache getBlock
- // we end up calling l2Cache.getBlock.
boolean existInL1 = lruCache.containsBlock(cacheKey);
if (!existInL1 && updateCacheMetrics && !repeat) {
// If the block does not exist in L1, this check should be counted as a miss.
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/InclusiveCombinedBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/InclusiveCombinedBlockCache.java
index 667e7b4..71b7b9b5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/InclusiveCombinedBlockCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/InclusiveCombinedBlockCache.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
public class InclusiveCombinedBlockCache extends CombinedBlockCache implements BlockCache {
public InclusiveCombinedBlockCache(LruBlockCache l1, BlockCache l2) {
super(l1,l2);
+ l1.setVictimCache(l2);
}
@Override