Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ public void testRetrieveFromFile() throws Exception {
FileSystems.getDefault().getPath(testDir.toString(), "bucket.cache");
assertTrue(Files.deleteIfExists(cacheFile));
// can't restore cache from file
recoveredBucketCache = new BucketCache("file:" + testDir + "/bucket.cache", capacitySize,
constructedBlockSize, constructedBlockSizes, writeThreads, writerQLen,
testDir + "/bucket.persistence" + name.getMethodName());
assertTrue(recoveredBucketCache.waitForCacheInitialization(10000));
recoveredBucketCache =
new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, constructedBlockSize,
constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence");
waitPersistentCacheValidation(conf, bucketCache);
assertEquals(0, recoveredBucketCache.getAllocator().getUsedSize());
assertEquals(0, recoveredBucketCache.backingMap.size());
BlockCacheKey[] newKeys = CacheTestUtils.regenerateKeys(blocks, names);
Expand Down Expand Up @@ -512,6 +512,7 @@ private void cacheAndWaitUntilFlushedToBucket(BucketCache cache, BlockCacheKey c
}

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