public void testInUse() throws Exception {
FlushCounter handler = new FlushCounter();
SortedOplogSet sos = createSoplogSet("inuse");
for (int i = 0; i < 1000; i++) {
sos.put(wrapInt(i), wrapInt(i));
}
flushAndWait(handler, sos);
SortedIterator<ByteBuffer> range = sos.scan();
assertEquals(0, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
for (int i = 1000; i < 5000; i++) {
sos.put(wrapInt(i), wrapInt(i));
if (i % 100 == 0) {
sos.flush(null, handler);
}
}
flushAndWait(handler, sos);
compactAndWait(sos, false);
assertEquals(1, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
range.close();
compactAndWait(sos, false);
assertEquals(0, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
validate(sos, 5000);
sos.close();
}