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 15e226f..4ceda39 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 @@ -358,8 +358,7 @@ public class CombinedBlockCache implements ResizableBlockCache, HeapSize { @Override public void returnBlock(BlockCacheKey cacheKey, Cacheable block) { - // A noop - this.lruCache.returnBlock(cacheKey, block); + // returnBlock is meaningful for L2 cache alone. this.l2Cache.returnBlock(cacheKey, block); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java index 2fd9fdf..ec5de1d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java @@ -1156,6 +1156,13 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize { @Override public void returnBlock(BlockCacheKey cacheKey, Cacheable block) { - // There is no SHARED type here. Just return + // There is no SHARED type here in L1. But the block might have been served from the Victim + // handler L2 cache. (when the Combined mode = false). So just try return this block to + // L2 victim handler cache. + // Note : In case of CombinedBlockCache, we will have this victimHandler configured for L1 + // cache. But CombinedBlockCache will only call returnBlock on L2 cache. + if (this.victimHandler != null) { + this.victimHandler.returnBlock(cacheKey, block); + } } }