Skip to content

Commit d5f3fd3

Browse files
committed
HBASE-29783 Fix flaky TestVerifyBucketCacheFile.testRetrieveFromFile test (#7561)
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
1 parent 155cb79 commit d5f3fd3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestVerifyBucketCacheFile.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void testRetrieveFromFile() throws Exception {
138138
recoveredBucketCache =
139139
new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, constructedBlockSize,
140140
constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence");
141-
assertTrue(recoveredBucketCache.waitForCacheInitialization(10000));
141+
waitPersistentCacheValidation(conf, bucketCache);
142142
assertEquals(0, recoveredBucketCache.getAllocator().getUsedSize());
143143
assertEquals(0, recoveredBucketCache.backingMap.size());
144144
BlockCacheKey[] newKeys = CacheTestUtils.regenerateKeys(blocks, names);
@@ -494,6 +494,7 @@ private void cacheAndWaitUntilFlushedToBucket(BucketCache cache, BlockCacheKey c
494494
}
495495

496496
private void waitPersistentCacheValidation(Configuration config, final BucketCache bucketCache) {
497-
Waiter.waitFor(config, 5000, () -> bucketCache.getBackingMapValidated().get());
497+
Waiter.waitFor(config, 5000,
498+
() -> bucketCache.getBackingMapValidated().get() && bucketCache.isCacheEnabled());
498499
}
499500
}

0 commit comments

Comments
 (0)