use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method consistencyCheckWithGc.
@Test
public void consistencyCheckWithGc() throws Exception {
DataStoreState state = setUp(true);
Set<String> existingAfterGC = gc(0);
assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(86400, executor);
long candidates = gcObj.checkConsistency();
assertEquals(1, executor.getTaskCount());
assertEquals(0, candidates);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method consistencyCheckWithRenegadeDelete.
@Test
public void consistencyCheckWithRenegadeDelete() throws Exception {
DataStoreState state = setUp(true);
// Simulate faulty state by deleting some blobs directly
Random rand = new Random(87);
List<String> existing = Lists.newArrayList(state.blobsPresent);
GarbageCollectableBlobStore store = (GarbageCollectableBlobStore) mk.getNodeStore().getBlobStore();
long count = store.countDeleteChunks(ImmutableList.of(existing.get(rand.nextInt(existing.size()))), 0);
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(86400, executor);
long candidates = gcObj.checkConsistency();
assertEquals(1, executor.getTaskCount());
assertEquals(count, candidates);
}
Aggregations