HBASE-23375 HBASE-22441 BucketCache NullPointerException in cacheBlock

branches-1 backport. closes #907

Co-authored-by: binlijin <binlijin@apache.org>
Signed-off-by: binlijin <binlijin@apache.org>
Signed-off-by: Viraj Jasani <virajjasani007@gmail.com>
Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Baiqiang Zhao 2019-12-06 15:28:56 +08:00 committed by Sean Busbey
parent 84c0a90ba4
commit 28673f0c22
1 changed files with 3 additions and 0 deletions

View File

@ -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 "