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

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


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

commit 5dcfe5f8d85198bac81793c42d3ebceb47154bd7
Author: binlijin <[email protected]>
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) {

Reply via email to