use of org.apache.jackrabbit.oak.plugins.document.JournalGarbageCollector in project jackrabbit-oak by apache.
the class JournalIT method doLargeCleanupTest.
private void doLargeCleanupTest(int offset, int size) throws Exception {
Clock clock = new Clock.Virtual();
DocumentMK mk1 = createMK(0, /* clusterId: 0 => uses clusterNodes collection */
0, new MemoryDocumentStore(), new MemoryBlobStore());
DocumentNodeStore ns1 = mk1.getNodeStore();
// make sure we're visible and marked as active
renewClusterIdLease(ns1);
JournalGarbageCollector gc = new JournalGarbageCollector(ns1);
clock.getTimeIncreasing();
clock.getTimeIncreasing();
// cleanup everything that might still be there
gc.gc(0, TimeUnit.MILLISECONDS);
// create entries as parametrized:
for (int i = offset; i < size + offset; i++) {
mk1.commit("/", "+\"regular" + i + "\": {}", null, null);
// always run background ops to 'flush' the change
// into the journal:
ns1.runBackgroundOperations();
}
// sleep 100millis
Thread.sleep(100);
// should now be able to clean up everything
assertEquals(size, gc.gc(0, TimeUnit.MILLISECONDS));
}
Aggregations