@Test public void testReusingChunks() { Random rand = new Random(); MemStoreLAB mslab = new HeapMemStoreLAB(conf); int expectedOff = 0; byte[] lastBuffer = null; for (int i = 0; i < 100; i++) { int size = rand.nextInt(1000); ByteRange alloc = mslab.allocateBytes(size); if (alloc.getBytes() != lastBuffer) { expectedOff = 0; lastBuffer = alloc.getBytes(); } assertEquals(expectedOff, alloc.getOffset()); assertTrue("Allocation overruns buffer", alloc.getOffset() + size <= alloc.getBytes().length); expectedOff += size; } mslab.close(); int chunkCount = chunkPool.getPoolSize(); assertTrue(chunkCount > 0); mslab = new HeapMemStoreLAB(conf); mslab.allocateBytes(1000); assertEquals(chunkCount - 1, chunkPool.getPoolSize()); }
int getPoolSize() { return this.reclaimedChunks.size(); }
MemStoreChunkPool { int getPoolSize() { return this.reclaimedChunks.size(); } }
MemStoreChunkPool { int getPoolSize() { return this.reclaimedChunks.size(); } MemStoreChunkPool(Configuration conf, int chunkSize, int maxCount,
      int initialCount); }
MemStoreChunkPool { int getPoolSize() { return this.reclaimedChunks.size(); } MemStoreChunkPool(Configuration conf, int chunkSize, int maxCount,
      int initialCount);  }
MemStoreChunkPool { int getPoolSize() { return this.reclaimedChunks.size(); } MemStoreChunkPool(Configuration conf, int chunkSize, int maxCount,
      int initialCount);   }