You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2025/08/08 12:50:35 UTC
(hbase) branch branch-3 updated: HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent failure caused by RAMCache draining in between (#7205)
This is an automated email from the ASF dual-hosted git repository.
wchevreuil pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new 4d2ce50de37 HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent failure caused by RAMCache draining in between (#7205)
4d2ce50de37 is described below
commit 4d2ce50de371bcd3c04a6ba4d30ecf115d0cbe8a
Author: Umesh <94...@gmail.com>
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 <wc...@apache.org>
---
.../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);