This is an automated email from the ASF dual-hosted git repository.
wchevreuil 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 96faaaaf2dd HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache
intermittent failure caused by RAMCache draining in between (#7205)
96faaaaf2dd is described below
commit 96faaaaf2dd6e2bc9debc7963ca4d622b678221b
Author: Umesh <[email protected]>
AuthorDate: Fri Aug 8 17:49:22 2025 +0530
HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent
failure caused by RAMCache draining in between (#7205)
Signed-off-by: Wellington Chevreuil <[email protected]>
---
.../hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
index e71817e6a3f..4ee3f37819f 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
@@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.io.ByteBuffAllocator;
import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil;
@@ -229,6 +230,10 @@ public class TestBucketCacheRefCnt {
cache.cacheBlock(key, blk);
assertTrue(blk.refCnt() == 1 || blk.refCnt() == 2);
+ // wait for block to move to backing map because refCnt get refreshed
once block moves to
+ // backing map
+ Waiter.waitFor(HBaseConfiguration.create(), 12000, () ->
isRamCacheDrained(key, cache));
+
Cacheable block1 = cache.getBlock(key, false, false, false);
assertTrue(block1.refCnt() >= 2);
assertTrue(((HFileBlock) block1).getByteBuffAllocator() == alloc);
@@ -262,6 +267,10 @@ public class TestBucketCacheRefCnt {
}
}
+ private boolean isRamCacheDrained(BlockCacheKey key, BucketCache cache) {
+ return cache.backingMap.containsKey(key) &&
!cache.ramCache.containsKey(key);
+ }
+
@Test
public void testMarkStaleAsEvicted() throws Exception {
cache = create(1, 1000);