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

busbey 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 28673f0  HBASE-23375 HBASE-22441 BucketCache NullPointerException in 
cacheBlock
28673f0 is described below

commit 28673f0c22f71d150200aff0afe68c507a59d2f4
Author: Baiqiang Zhao <[email protected]>
AuthorDate: Fri Dec 6 15:28:56 2019 +0800

    HBASE-23375 HBASE-22441 BucketCache NullPointerException in cacheBlock
    
    branches-1 backport. closes #907
    
    Co-authored-by: binlijin <[email protected]>
    Signed-off-by: binlijin <[email protected]>
    Signed-off-by: Viraj Jasani <[email protected]>
    Signed-off-by: Sean Busbey <[email protected]>
---
 .../src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
index dfc2796..66e99ad 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
@@ -230,6 +230,9 @@ public class BlockCacheUtil {
   public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache,
       BlockCacheKey cacheKey, Cacheable newBlock) {
     Cacheable existingBlock = blockCache.getBlock(cacheKey, false, false, 
false);
+    if (existingBlock == null) {
+      return true;
+    }
     int comparison = BlockCacheUtil.validateBlockAddition(existingBlock, 
newBlock, cacheKey);
     if (comparison < 0) {
       LOG.warn("Cached block contents differ by nextBlockOnDiskSize, the new 
block has "

Reply via email to