use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class SegmentDataStoreBlobGCIT method consistencyCheckWithRenegadeDelete.
@Test
public void consistencyCheckWithRenegadeDelete() throws Exception {
DataStoreState state = setUp();
// Simulate faulty state by deleting some blobs directly
Random rand = new Random(87);
List<String> existing = Lists.newArrayList(state.blobsPresent);
long count = blobStore.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);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class SegmentDataStoreBlobGCIT method checkMark.
@Test
public void checkMark() throws Exception {
LogCustomizer customLogs = LogCustomizer.forLogger(MarkSweepGarbageCollector.class.getName()).enable(Level.TRACE).filter(Level.TRACE).create();
DataStoreState state = setUp(10);
log.info("{} blobs available : {}", state.blobsPresent.size(), state.blobsPresent);
customLogs.starting();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
String rootFolder = folder.newFolder().getAbsolutePath();
MarkSweepGarbageCollector gcObj = init(0, executor, rootFolder);
gcObj.collectGarbage(true);
customLogs.finished();
assertBlobReferenceRecords(state.blobsPresent, rootFolder);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method checkGcPathLogging.
@Test
public void checkGcPathLogging() throws Exception {
String rootFolder = folder.newFolder().getAbsolutePath();
LogCustomizer customLogs = LogCustomizer.forLogger(MarkSweepGarbageCollector.class.getName()).enable(Level.TRACE).filter(Level.TRACE).create();
setUp(false);
customLogs.starting();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(0, executor, rootFolder);
gcObj.collectGarbage(true);
customLogs.finished();
assertBlobReferenceRecords(1, rootFolder);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method consistencyCheckInit.
@Test
public void consistencyCheckInit() throws Exception {
DataStoreState state = setUp(true);
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 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);
}
Aggregations