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 8d92924fe1f HBASE-30144 Fix flakeyness on TestPrefetchWithBucketCache 
(#8198)
8d92924fe1f is described below

commit 8d92924fe1ffe79164d4470f63ea202e58f75b87
Author: Wellington Ramos Chevreuil <[email protected]>
AuthorDate: Thu May 7 10:43:41 2026 +0100

    HBASE-30144 Fix flakeyness on TestPrefetchWithBucketCache (#8198)
    
    Signed-off-by: Peter Somogyi <[email protected]>
---
 .../hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
index 629a9af2333..1eebf5c6f4d 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
@@ -313,13 +313,17 @@ public class TestPrefetchWithBucketCache {
   public void testPrefetchRunTriggersEvictions() throws Exception {
     conf.setLong(BUCKET_CACHE_SIZE_KEY, 1);
     conf.set(BUCKET_CACHE_BUCKETS_KEY, "3072");
-    conf.setDouble("hbase.bucketcache.acceptfactor", 0.98);
-    conf.setDouble("hbase.bucketcache.minfactor", 0.98);
+    // Use full capacity as the "acceptable" size so prefetch does not stop at 
~98% total usage
+    // (via blockFitsIntoTheCache) before the cache writer path must run 
freeSpace/evictions.
+    conf.setDouble("hbase.bucketcache.acceptfactor", 1.0);
+    conf.setDouble("hbase.bucketcache.minfactor", 1.0);
     conf.setDouble("hbase.bucketcache.extrafreefactor", 0.0);
     conf.setLong(QUEUE_ADDITION_WAIT_TIME, 0);
+    // Ensures no prefetch interruption due to heap usage in the event of 
freeMemory() returning 0.
+    conf.setDouble(CacheConfig.PREFETCH_HEAP_USAGE_THRESHOLD, 
Double.MAX_VALUE);
     blockCache = BlockCacheFactory.createBlockCache(conf);
     cacheConf = new CacheConfig(conf, blockCache);
-    Path storeFile = writeStoreFile("testPrefetchInterruptOnCapacity", 10000);
+    Path storeFile = writeStoreFile("testPrefetchRunTriggersEvictions", 10000);
     // Prefetches the file blocks
     createReaderAndWaitForPrefetchInterruption(storeFile);
     Waiter.waitFor(conf, (PrefetchExecutor.getPrefetchDelay() + 1000),
@@ -336,7 +340,8 @@ public class TestPrefetchWithBucketCache {
     });
     if (bc.getStats().getFailedInserts() == 0) {
       // With no wait time configuration, prefetch should trigger evictions 
once it reaches
-      // cache capacity
+      // cache capacity. Writer threads can finish draining slightly after 
queue.offer returns.
+      Waiter.waitFor(conf, 15000, () -> bc.getStats().getEvictedCount() > 0);
       assertNotEquals(0, bc.getStats().getEvictedCount());
     } else {
       LOG.info("We had {} cache insert failures, which may cause cache usage "

Reply via email to