Skip to content

Commit 4661621

Browse files
committed
HBASE-29783 Fix flaky TestVerifyBucketCacheFile.testRetrieveFromFile test (apache#7561)
Signed-off-by: Peter Somogyi <[email protected]> Change-Id: I57fdef54e953a94a24020c99c3ebbc2741fdf519
1 parent 38306f7 commit 4661621

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ public void testRetrieveFromFile() throws Exception {
140140
FileSystems.getDefault().getPath(testDir.toString(), "bucket.cache");
141141
assertTrue(Files.deleteIfExists(cacheFile));
142142
// can't restore cache from file
143-
recoveredBucketCache = new BucketCache("file:" + testDir + "/bucket.cache", capacitySize,
144-
constructedBlockSize, constructedBlockSizes, writeThreads, writerQLen,
145-
testDir + "/bucket.persistence" + name.getMethodName());
146-
assertTrue(recoveredBucketCache.waitForCacheInitialization(10000));
143+
recoveredBucketCache =
144+
new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, constructedBlockSize,
145+
constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence");
146+
waitPersistentCacheValidation(conf, bucketCache);
147147
assertEquals(0, recoveredBucketCache.getAllocator().getUsedSize());
148148
assertEquals(0, recoveredBucketCache.backingMap.size());
149149
BlockCacheKey[] newKeys = CacheTestUtils.regenerateKeys(blocks, names);
@@ -512,6 +512,7 @@ private void cacheAndWaitUntilFlushedToBucket(BucketCache cache, BlockCacheKey c
512512
}
513513

514514
private void waitPersistentCacheValidation(Configuration config, final BucketCache bucketCache) {
515-
Waiter.waitFor(config, 5000, () -> bucketCache.getBackingMapValidated().get());
515+
Waiter.waitFor(config, 5000,
516+
() -> bucketCache.getBackingMapValidated().get() && bucketCache.isCacheEnabled());
516517
}
517518
}

0 commit comments

Comments
 (0)