Examples of cacheBlock()


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

   
    Block[] blocks = generateFixedBlocks(10, blockSize, "block");
   
    // Add all the blocks
    for (Block block : blocks) {
      cache.cacheBlock(block.blockName, block.buf);
    }
   
    // Let the eviction run
    int n = 0;
    while (cache.getEvictionCount() == 0) {
View Full Code Here

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

      assertTrue(cache.getBlock(block.blockName) == null);
    }
   
    // Add blocks
    for (Block block : blocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
    }
   
    // Verify correctly calculated cache heap size
    assertEquals(expectedCacheSize, cache.heapSize());
View Full Code Here

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

   
    long expectedCacheSize = cache.heapSize();
   
    // Add all the blocks
    for (Block block : blocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
    }
   
    // A single eviction run should have occurred
    assertEquals(1, cache.getEvictionCount());
View Full Code Here

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

   
    long expectedCacheSize = cache.heapSize();
   
    // Add and get the multi blocks
    for (Block block : multiBlocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
      assertEquals(cache.getBlock(block.blockName), block.buf);
    }
   
    // Add the single blocks (no get)
View Full Code Here

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

      assertEquals(cache.getBlock(block.blockName), block.buf);
    }
   
    // Add the single blocks (no get)
    for (Block block : singleBlocks) {
      cache.cacheBlock(block.blockName, block.buf);
      expectedCacheSize += block.heapSize();
    }
   
    // A single eviction run should have occurred
    assertEquals(cache.getEvictionCount(), 1);
View Full Code Here

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

   
    // Add 3 blocks from each priority
    for (int i = 0; i < 3; i++) {
     
      // Just add single blocks
      cache.cacheBlock(singleBlocks[i].blockName, singleBlocks[i].buf);
      expectedCacheSize += singleBlocks[i].heapSize();
     
      // Add and get multi blocks
      cache.cacheBlock(multiBlocks[i].blockName, multiBlocks[i].buf);
      expectedCacheSize += multiBlocks[i].heapSize();
View Full Code Here

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

      // Just add single blocks
      cache.cacheBlock(singleBlocks[i].blockName, singleBlocks[i].buf);
      expectedCacheSize += singleBlocks[i].heapSize();
     
      // Add and get multi blocks
      cache.cacheBlock(multiBlocks[i].blockName, multiBlocks[i].buf);
      expectedCacheSize += multiBlocks[i].heapSize();
      cache.getBlock(multiBlocks[i].blockName);
     
      // Add memory blocks as such
      cache.cacheBlock(memoryBlocks[i].blockName, memoryBlocks[i].buf, true);
View Full Code Here

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

      cache.cacheBlock(multiBlocks[i].blockName, multiBlocks[i].buf);
      expectedCacheSize += multiBlocks[i].heapSize();
      cache.getBlock(multiBlocks[i].blockName);
     
      // Add memory blocks as such
      cache.cacheBlock(memoryBlocks[i].blockName, memoryBlocks[i].buf, true);
      expectedCacheSize += memoryBlocks[i].heapSize();
     
    }
   
    // Do not expect any evictions yet
View Full Code Here

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

   
    // Verify cache size
    assertEquals(expectedCacheSize, cache.heapSize());
   
    // Insert a single block, oldest single should be evicted
    cache.cacheBlock(singleBlocks[3].blockName, singleBlocks[3].buf);
   
    // Single eviction, one thing evicted
    assertEquals(1, cache.getEvictionCount());
    assertEquals(1, cache.getEvictedCount());
   
View Full Code Here

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

   
    // Change the oldest remaining single block to a multi
    cache.getBlock(singleBlocks[1].blockName);
   
    // Insert another single block
    cache.cacheBlock(singleBlocks[4].blockName, singleBlocks[4].buf);
   
    // Two evictions, two evicted.
    assertEquals(2, cache.getEvictionCount());
    assertEquals(2, cache.getEvictedCount());
   
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.