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);
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class SegmentDataStoreBlobGCIT method consistencyCheckWithGc.
@Test
public void consistencyCheckWithGc() throws Exception {
DataStoreState state = setUp();
Set<String> existingAfterGC = gcInternal(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 SegmentDataStoreBlobGCIT method init.
private MarkSweepGarbageCollector init(long blobGcMaxAgeInSecs, ThreadPoolExecutor executor, String root) throws Exception {
String repoId = null;
if (SharedDataStoreUtils.isShared(store.getBlobStore())) {
repoId = ClusterRepositoryInfo.getOrCreateId(nodeStore);
((SharedDataStore) store.getBlobStore()).addMetadataRecord(new ByteArrayInputStream(new byte[0]), REPOSITORY.getNameFromId(repoId));
}
MarkSweepGarbageCollector gc = new MarkSweepGarbageCollector(new SegmentBlobReferenceRetriever(store), (GarbageCollectableBlobStore) store.getBlobStore(), executor, root, 2048, blobGcMaxAgeInSecs, repoId);
return gc;
}
use of org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector in project jackrabbit-oak by apache.
the class SegmentDataStoreBlobGCIT method consistencyCheckInlined.
@Test
public void consistencyCheckInlined() throws Exception {
blobStore = new DataStoreBlobStore(DataStoreUtils.createFDS(new File(getWorkDir(), "datastore"), 16516));
DataStoreState state = setUp();
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 SegmentDataStoreBlobGCIT method consistencyCheckInit.
@Test
public void consistencyCheckInit() throws Exception {
DataStoreState state = setUp();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
MarkSweepGarbageCollector gcObj = init(86400, executor);
long candidates = gcObj.checkConsistency();
assertEquals(1, executor.getTaskCount());
assertEquals(0, candidates);
}
Aggregations