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/26 09:18:44 UTC
(hbase) branch branch-2.6 updated: HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent failure caused by RAMCache draining in between (#7205) (#7206)
This is an automated email from the ASF dual-hosted git repository.
wchevreuil pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.6 by this push:
new af11cf6eab8 HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent failure caused by RAMCache draining in between (#7205) (#7206)
af11cf6eab8 is described below
commit af11cf6eab87993f6539635df5ce84f0097af6f6
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Tue Aug 26 09:49:07 2025 +0100
HBASE-29493 Triage TestBucketCacheRefCnt.testInBucketCache intermittent failure caused by RAMCache draining in between (#7205) (#7206)
Signed-off-by: Wellington Chevreuil <wc...@apache.org>
Co-authored-by: Umesh <94...@gmail.com>
---
.../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);