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/16 02:28:50 UTC

[hbase] branch branch-2 updated: HBASE-26083 In branch-2 & branch-1 L1 miss metric is always 0 when using CombinedBlockCache (#3473)

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

reidchan pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new fb01a6c  HBASE-26083 In branch-2 & branch-1 L1 miss metric is always 0 when using CombinedBlockCache (#3473)
fb01a6c is described below

commit fb01a6c276f4c5c264f16194c6a4764e3fb521ba
Author: YutSean <yu...@gmail.com>
AuthorDate: Fri Jul 16 10:28:27 2021 +0800

    HBASE-26083 In branch-2 & branch-1 L1 miss metric is always 0 when using CombinedBlockCache (#3473)
    
    Signed-off-by Anoop Sam John <an...@apache.org>
    Signed-off-by Reid Chan <re...@apache.org>
---
 .../java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 92f5a47..d3f2a73 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
@@ -78,7 +78,13 @@ public class CombinedBlockCache implements ResizableBlockCache, HeapSize {
     // we end up calling l2Cache.getBlock.
     // We are not in a position to exactly look at LRU cache or BC as BlockType may not be getting
     // passed always.
-    return l1Cache.containsBlock(cacheKey)?
+    boolean existInL1 = l1Cache.containsBlock(cacheKey);
+    if (!existInL1 && updateCacheMetrics && !repeat) {
+      // If the block does not exist in L1, the containsBlock should be counted as one miss.
+      l1Cache.getStats().miss(caching, cacheKey.isPrimary(), cacheKey.getBlockType());
+    }
+
+    return existInL1 ?
         l1Cache.getBlock(cacheKey, caching, repeat, updateCacheMetrics):
         l2Cache.getBlock(cacheKey, caching, repeat, updateCacheMetrics);
   }