You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bi...@apache.org on 2019/05/27 09:15:47 UTC

[hbase] branch branch-2.2 updated: HBASE-22441 BucketCache NullPointerException in cacheBlock

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

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


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 1845153  HBASE-22441 BucketCache NullPointerException in cacheBlock
1845153 is described below

commit 1845153d600a04951add1f883ba8de7e987d4af4
Author: binlijin <bi...@apache.org>
AuthorDate: Mon May 27 17:14:42 2019 +0800

    HBASE-22441 BucketCache NullPointerException in cacheBlock
---
 .../main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java    | 4 ++++
 1 file changed, 4 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 cce7972..0cb2bd1 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
@@ -229,6 +229,10 @@ public class BlockCacheUtil {
   public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache,
       BlockCacheKey cacheKey, Cacheable newBlock) {
     Cacheable existingBlock = blockCache.getBlock(cacheKey, false, false, false);
+    if (null == existingBlock) {
+      // Not exist now.
+      return true;
+    }
     try {
       int comparison = BlockCacheUtil.validateBlockAddition(existingBlock, newBlock, cacheKey);
       if (comparison < 0) {