Package org.apache.accumulo.core.file.blockfile.cache

Examples of org.apache.accumulo.core.file.blockfile.cache.LruBlockCache.heapSize()


   
    LruBlockCache cache = new LruBlockCache(maxSize, blockSize);
   
    Block[] blocks = generateRandomBlocks(100, blockSize);
   
    long expectedCacheSize = cache.heapSize();
   
    // Confirm empty
    for (Block block : blocks) {
      assertTrue(cache.getBlock(block.blockName) == null);
    }
View Full Code Here


      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
    }
   
    // Verify correctly calculated cache heap size
    assertEquals(expectedCacheSize, cache.heapSize());
   
    // Check if all blocks are properly cached and retrieved
    for (Block block : blocks) {
      byte buf1[] = cache.getBlock(block.blockName);
      assertTrue(buf1 != null);
View Full Code Here

      assertTrue(buf1 != null);
      assertEquals(buf1.length, block.buf.length);
    }
   
    // Verify correctly calculated cache heap size
    assertEquals(expectedCacheSize, cache.heapSize());
   
    // Check if all blocks are properly cached and retrieved
    for (Block block : blocks) {
      byte buf1[] = cache.getBlock(block.blockName);
      assertTrue(buf1 != null);
View Full Code Here

   
    LruBlockCache cache = new LruBlockCache(maxSize, blockSize, false);
   
    Block[] blocks = generateFixedBlocks(10, blockSize, "block");
   
    long expectedCacheSize = cache.heapSize();
   
    // Add all the blocks
    for (Block block : blocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
View Full Code Here

   
    // Our expected size overruns acceptable limit
    assertTrue(expectedCacheSize > (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // But the cache did not grow beyond max
    assertTrue(cache.heapSize() < maxSize);
   
    // And is still below the acceptable limit
    assertTrue(cache.heapSize() < (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // All blocks except block 0 and 1 should be in the cache
View Full Code Here

   
    // But the cache did not grow beyond max
    assertTrue(cache.heapSize() < maxSize);
   
    // And is still below the acceptable limit
    assertTrue(cache.heapSize() < (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // All blocks except block 0 and 1 should be in the cache
    assertTrue(cache.getBlock(blocks[0].blockName) == null);
    assertTrue(cache.getBlock(blocks[1].blockName) == null);
    for (int i = 2; i < blocks.length; i++) {
View Full Code Here

        0.25f);// memory
   
    Block[] singleBlocks = generateFixedBlocks(5, 10000, "single");
    Block[] multiBlocks = generateFixedBlocks(5, 10000, "multi");
   
    long expectedCacheSize = cache.heapSize();
   
    // Add and get the multi blocks
    for (Block block : multiBlocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
View Full Code Here

   
    // Our expected size overruns acceptable limit
    assertTrue(expectedCacheSize > (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // But the cache did not grow beyond max
    assertTrue(cache.heapSize() <= maxSize);
   
    // And is now below the acceptable limit
    assertTrue(cache.heapSize() <= (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // We expect fairness across the two priorities.
View Full Code Here

   
    // But the cache did not grow beyond max
    assertTrue(cache.heapSize() <= maxSize);
   
    // And is now below the acceptable limit
    assertTrue(cache.heapSize() <= (maxSize * LruBlockCache.DEFAULT_ACCEPTABLE_FACTOR));
   
    // We expect fairness across the two priorities.
    // This test makes multi go barely over its limit, in-memory
    // empty, and the rest in single. Two single evictions and
    // one multi eviction expected.
View Full Code Here

   
    Block[] singleBlocks = generateFixedBlocks(5, blockSize, "single");
    Block[] multiBlocks = generateFixedBlocks(5, blockSize, "multi");
    Block[] memoryBlocks = generateFixedBlocks(5, blockSize, "memory");
   
    long expectedCacheSize = cache.heapSize();
   
    // Add 3 blocks from each priority
    for (int i = 0; i < 3; i++) {
     
      // Just add single blocks
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.