This is an automated email from the ASF dual-hosted git repository.
binlijin pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 8e9b504 HBASE-22441 BucketCache NullPointerException in cacheBlock
8e9b504 is described below
commit 8e9b504ffebf92001389d336b9a1a10e250451f2
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 36f9e61..397b489 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
@@ -227,6 +227,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) {