Skip to content

Commit edd6ea9

Browse files
authored
HBASE-26083 L1 miss metric is always 0 when using CombinedBlockCache (#3474)
Signed-off-by Anoop Sam John <anoopsamjohn@apache.org> Signed-off-by Reid Chan <reidchan@apache.org>
1 parent 3b3ec32 commit edd6ea9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ public Cacheable getBlock(BlockCacheKey cacheKey, boolean caching,
7979
boolean repeat, boolean updateCacheMetrics) {
8080
// TODO: is there a hole here, or just awkwardness since in the lruCache getBlock
8181
// we end up calling l2Cache.getBlock.
82-
return lruCache.containsBlock(cacheKey)?
82+
boolean existInL1 = lruCache.containsBlock(cacheKey);
83+
if (!existInL1 && updateCacheMetrics && !repeat) {
84+
// If the block does not exist in L1, this check should be counted as a miss.
85+
combinedCacheStats.lruCacheStats
86+
.miss(caching, cacheKey.isPrimary(), cacheKey.getBlockType());
87+
}
88+
return existInL1 ?
8389
lruCache.getBlock(cacheKey, caching, repeat, updateCacheMetrics):
8490
l2Cache.getBlock(cacheKey, caching, repeat, updateCacheMetrics);
8591
}

0 commit comments

Comments
 (0)