private void validateGetPartitionSize(BucketCache bucketCache, float partitionFactor, float minFactor) { long expectedOutput = (long) Math.floor(bucketCache.getAllocator().getTotalSize() * partitionFactor * minFactor); assertEquals(expectedOutput, bucketCache.getPartitionSize(partitionFactor)); }
bucketAllocator = ((BucketCache)bc).getAllocator();
@Test public void testBucketAllocator() throws BucketAllocatorException { BucketAllocator mAllocator = cache.getAllocator();
long usedSize = bucketCache.getAllocator().getUsedSize(); assertEquals(0, usedSize); cacheAndWaitUntilFlushedToBucket(bucketCache, block.getBlockName(), block.getBlock()); usedSize = bucketCache.getAllocator().getUsedSize(); assertNotEquals(0, usedSize); constructedBlockSizes, writeThreads, writerQLen, persistencePath); assertFalse(new File(persistencePath).exists()); assertEquals(usedSize, bucketCache.getAllocator().getUsedSize()); smallBucketSizes, writeThreads, writerQLen, persistencePath); assertFalse(new File(persistencePath).exists()); assertEquals(0, bucketCache.getAllocator().getUsedSize()); assertEquals(0, bucketCache.backingMap.size());
private void validateGetPartitionSize(BucketCache bucketCache, float partitionFactor, float minFactor) { long expectedOutput = (long) Math.floor(bucketCache.getAllocator().getTotalSize() * partitionFactor * minFactor); assertEquals(expectedOutput, bucketCache.getPartitionSize(partitionFactor)); }
bucketAllocator = ((BucketCache)bc).getAllocator();
@Test public void testBucketAllocator() throws BucketAllocatorException { BucketAllocator mAllocator = cache.getAllocator();
constructedBlockSize, constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence"); long usedSize = bucketCache.getAllocator().getUsedSize(); assertTrue(usedSize == 0); cacheAndWaitUntilFlushedToBucket(bucketCache, block.getBlockName(), block.getBlock()); usedSize = bucketCache.getAllocator().getUsedSize(); assertTrue(usedSize != 0); constructedBlockSize, constructedBlockSizes, writeThreads, writerQLen, testDir + "/bucket.persistence"); assertEquals(usedSize, bucketCache.getAllocator().getUsedSize()); constructedBlockSize, smallBucketSizes, writeThreads, writerQLen, testDir + "/bucket.persistence"); assertEquals(0, bucketCache.getAllocator().getUsedSize()); assertEquals(0, bucketCache.backingMap.size());