HBASE-22441 BucketCache NullPointerException in cacheBlock

This commit is contained in:
binlijin 2019-05-27 17:14:42 +08:00
parent 378e8ba58f
commit 8e9b504ffe
1 changed files with 4 additions and 0 deletions

View File

@ -227,6 +227,10 @@ public class BlockCacheUtil {
public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache, public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache,
BlockCacheKey cacheKey, Cacheable newBlock) { BlockCacheKey cacheKey, Cacheable newBlock) {
Cacheable existingBlock = blockCache.getBlock(cacheKey, false, false, false); Cacheable existingBlock = blockCache.getBlock(cacheKey, false, false, false);
if (null == existingBlock) {
// Not exist now.
return true;
}
try { try {
int comparison = BlockCacheUtil.validateBlockAddition(existingBlock, newBlock, cacheKey); int comparison = BlockCacheUtil.validateBlockAddition(existingBlock, newBlock, cacheKey);
if (comparison < 0) { if (comparison < 0) {