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 2026/07/08 17:47:31 UTC
(hbase) branch branch-3 updated: HBASE-30275 TestRecoveryPersistentBucketCache#testBucketCacheRecoveryWithAllocationInconsistencies has a race condition between backingMapValidated and cacheState=ENABLED (#8456)
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 0025dfdf835 HBASE-30275 TestRecoveryPersistentBucketCache#testBucketCacheRecoveryWithAllocationInconsistencies has a race condition between backingMapValidated and cacheState=ENABLED (#8456)
0025dfdf835 is described below
commit 0025dfdf83527edad30e89812014251f6dde0520
Author: Aman Poonia <am...@gmail.com>
AuthorDate: Wed Jul 8 15:28:55 2026 +0530
HBASE-30275 TestRecoveryPersistentBucketCache#testBucketCacheRecoveryWithAllocationInconsistencies has a race condition between backingMapValidated and cacheState=ENABLED (#8456)
Signed-off-by: Wellington Chevreuil <wc...@apache.org>
Signed-off-by: Viraj Jasani <vj...@apache.org>
Signed-off-by: Peng Lu <lu...@apache.org>
Reviewed-by: Umesh Kumar <94...@gmail.com>
---
.../io/hfile/bucket/TestRecoveryPersistentBucketCache.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestRecoveryPersistentBucketCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestRecoveryPersistentBucketCache.java
index c3fcc267f47..adc072b8d50 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestRecoveryPersistentBucketCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestRecoveryPersistentBucketCache.java
@@ -22,10 +22,12 @@ import static org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.ACCEPT_FACTOR_
import static org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.DEFAULT_ERROR_TOLERATION_DURATION;
import static org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.EXTRA_FREE_FACTOR_CONFIG_NAME;
import static org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.MIN_FACTOR_CONFIG_NAME;
+import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.time.Duration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -251,9 +253,11 @@ public class TestRecoveryPersistentBucketCache {
BucketCache newBucketCache = new BucketCache("file:" + testDir + "/bucket.cache", 36 * 1024,
8192, bucketSizes, writeThreads, writerQLen, testDir + "/bucket.persistence",
DEFAULT_ERROR_TOLERATION_DURATION, conf);
- while (!newBucketCache.getBackingMapValidated().get()) {
- Thread.sleep(10);
- }
+ // backingMapValidated is set inside retrieveFromFile(), but isCacheEnabled() (which
+ // getBlock() checks) is set to true only in the finally block that follows. Waiting on
+ // backingMapValidated alone leaves a race window; await both conditions together.
+ await().atMost(Duration.ofSeconds(30)).pollInterval(Duration.ofMillis(10)).until(
+ () -> newBucketCache.getBackingMapValidated().get() && newBucketCache.isCacheEnabled());
BlockCacheKey[] newKeys = CacheTestUtils.regenerateKeys(blocks, names);