use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method checkConsistencyPathLogging.
@Test
public void checkConsistencyPathLogging() 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(86400, executor, rootFolder);
gcObj.checkConsistency();
customLogs.finished();
assertBlobReferenceRecords(2, rootFolder);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method checkMark.
@Test
public void checkMark() throws Exception {
String rootFolder = folder.newFolder().getAbsolutePath();
LogCustomizer customLogs = LogCustomizer.forLogger(MarkSweepGarbageCollector.class.getName()).enable(Level.TRACE).filter(Level.TRACE).create();
DataStoreState state = setUp(true, 10);
log.info("{} blobs available : {}", state.blobsPresent.size(), state.blobsPresent);
customLogs.starting();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(0, executor, rootFolder);
gcObj.collectGarbage(true);
customLogs.finished();
assertBlobReferences(state.blobsPresent, rootFolder);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method init.
private MarkSweepGarbageCollector init(int blobGcMaxAgeInSecs, ThreadPoolExecutor executor, String root) throws Exception {
DocumentNodeStore store = mk.getNodeStore();
String repoId = null;
if (SharedDataStoreUtils.isShared(store.getBlobStore())) {
repoId = ClusterRepositoryInfo.getOrCreateId(store);
((SharedDataStore) store.getBlobStore()).addMetadataRecord(new ByteArrayInputStream(new byte[0]), REPOSITORY.getNameFromId(repoId));
}
if (Strings.isNullOrEmpty(root)) {
root = folder.newFolder().getAbsolutePath();
}
MarkSweepGarbageCollector gc = new MarkSweepGarbageCollector(new DocumentBlobReferenceRetriever(store), (GarbageCollectableBlobStore) store.getBlobStore(), executor, root, 5, blobGcMaxAgeInSecs, repoId);
return gc;
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class MongoBlobGCTest method consistencyCheckInlined.
@Test
public void consistencyCheckInlined() throws Exception {
DataStoreState state = setUp(true);
addInlined();
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 gc.
private Set<String> gc(int blobGcMaxAgeInSecs) throws Exception {
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gc = init(blobGcMaxAgeInSecs, executor);
gc.collectGarbage(false);
assertEquals(0, executor.getTaskCount());
return iterate();
}
Aggregations