@Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); sb.append(";bytes=").append(getBytes()); return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); sb.append(";bytes=").append(getBytes()); return sb.toString(); } }
public void testReadStats() throws Exception { HoplogOrganizer<SortedHoplogPersistedEvent> bucket = regionManager.create(0); ArrayList<TestEvent> items = new ArrayList<TestEvent>(); for (int i = 0; i < 100; i++) { items.add(new TestEvent("key-" + i, "value-" + System.nanoTime())); } bucket.flush(items.iterator(), 100); // validate read stats assertEquals(0, stats.getRead().getCount()); assertEquals(0, stats.getRead().getBytes()); // number of bytes read must be greater than size of key and value and must be increasing int bytesRead = "key-1".getBytes().length + "value=1233232".getBytes().length; for (int i = 0; i < 5; i++) { long previousRead = stats.getRead().getBytes(); PersistedEventImpl e = bucket.read(BlobHelper.serializeToBlob("key-" + i)); assertNotNull(e); assertEquals(i + 1, stats.getRead().getCount()); assertTrue( (bytesRead + previousRead) < stats.getRead().getBytes()); } //Make sure the block cache stats are being updated. assertTrue(storeStats.getBlockCache().getMisses() > 0); assertTrue(storeStats.getBlockCache().getBytesCached() > 0); assertTrue(storeStats.getBlockCache().getCached() > 0); //Do a duplicate read to make sure we get a hit in the cache PersistedEventImpl e = bucket.read(BlobHelper.serializeToBlob("key-" + 0)); assertTrue(storeStats.getBlockCache().getHits() > 0); }
assertEquals(0, stats.getFlush().getBytes()); assertEquals(0, stats.getActiveFileCount()); int bytesSent = 0; assertTrue(stats.getFlush().getBytes() > bytesSent); assertEquals(j + 1, stats.getActiveFileCount()); assertEquals(0, stats.getMinorCompaction().getBytes()); assertEquals(0, stats.getInactiveFileCount()); bucket.getCompactor().compact(false, false); assertEquals(1, stats.getActiveFileCount()); assertEquals(0, stats.getInactiveFileCount()); assertEquals(stats.getMinorCompaction().getBytes(), stats.getFlush() .getBytes());