Repository: hbase
Updated Branches:
  refs/heads/master c9d0d11e1 -> 19bbf4455


HBASE-16651 LRUBlockCache#returnBlock should try return block to Victim Handler 
L2 cache.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/19bbf445
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/19bbf445
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/19bbf445

Branch: refs/heads/master
Commit: 19bbf44554886652ebf4a67487a27c21bf0e1ea7
Parents: c9d0d11
Author: anoopsamjohn <anoopsamj...@gmail.com>
Authored: Thu Sep 22 11:20:11 2016 +0530
Committer: anoopsamjohn <anoopsamj...@gmail.com>
Committed: Thu Sep 22 11:20:11 2016 +0530

----------------------------------------------------------------------
 .../apache/hadoop/hbase/io/hfile/CombinedBlockCache.java    | 3 +--
 .../org/apache/hadoop/hbase/io/hfile/LruBlockCache.java     | 9 ++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/19bbf445/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java
----------------------------------------------------------------------
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);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/19bbf445/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
----------------------------------------------------------------------
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..c56d7c6 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);
+    }
   }
 }

Reply via email to