Umesh Kumar Kumawat created HBASE-29493:
-------------------------------------------
Summary: TestBucketCacheRefCnt.testInBucketCache fails if block
found after eviction
Key: HBASE-29493
URL: https://issues.apache.org/jira/browse/HBASE-29493
Project: HBase
Issue Type: Bug
Components: BucketCache
Reporter: Umesh Kumar Kumawat
Assignee: Umesh Kumar Kumawat
{code:java}
HFileBlock blk = createBlock(200, 1020, alloc);
BlockCacheKey key = createKey("testHFile-00", 200);
cache.cacheBlock(key, blk);
assertTrue(blk.refCnt() == 1 || blk.refCnt() == 2);
Cacheable block1 = cache.getBlock(key, false, false, false);
assertTrue(block1.refCnt() >= 2);
assertTrue(((HFileBlock) block1).getByteBuffAllocator() == alloc);
Cacheable block2 = cache.getBlock(key, false, false, false);
assertTrue(((HFileBlock) block2).getByteBuffAllocator() == alloc);
assertTrue(block2.refCnt() >= 3);
cache.evictBlock(key);
assertTrue(blk.refCnt() >= 1);
assertTrue(block1.refCnt() >= 2);
assertTrue(block2.refCnt() >= 2);
// Get key again
Cacheable block3 = cache.getBlock(key, false, false, false);
if (block3 != null) {
assertTrue(((HFileBlock) block3).getByteBuffAllocator() == alloc);
assertTrue(block3.refCnt() >= 3);
assertFalse(block3.release());
}
{code}
In starting of the cache the block is stored in ramCache and later we drain it
to backingMap async. This test work fine if we only interact with ramCache but
sometime drain get completed just before we try to get the block again after
eviction. Wheneve the block moves to backingMap it start the ref from fresh so
2. And because of this Assertion in the if fails.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)