use of org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector in project jackrabbit-oak by apache.
the class DataStoreTrackerGCTest method addNodeSpecialChars.
private HashSet<String> addNodeSpecialChars(DocumentNodeStore ds) throws Exception {
List<String> specialCharSets = Lists.newArrayList("q\\%22afdg\\%22", "a\nbcd", "a\n\rabcd", "012\\efg");
HashSet<String> set = new HashSet<String>();
NodeBuilder a = ds.getRoot().builder();
int toBeDeleted = 0;
for (int i = 0; i < specialCharSets.size(); i++) {
Blob b = ds.createBlob(randomStream(i, 18432));
NodeBuilder n = a.child("cspecial" + i);
n.child(specialCharSets.get(i)).setProperty("x", b);
Iterator<String> idIter = ((GarbageCollectableBlobStore) ds.getBlobStore()).resolveChunks(b.toString());
List<String> ids = Lists.newArrayList(idIter);
if (toBeDeleted != i) {
set.addAll(ids);
}
}
ds.merge(a, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// Delete one node again
a = ds.getRoot().builder();
a.child("cspecial" + 0).remove();
ds.merge(a, INSTANCE, EMPTY);
// minutes
long maxAge = 10;
// 1. Go past GC age and check no GC done as nothing deleted
clock.waitUntil(clock.getTime() + MINUTES.toMillis(maxAge));
VersionGarbageCollector vGC = ds.getVersionGarbageCollector();
VersionGarbageCollector.VersionGCStats stats = vGC.gc(0, MILLISECONDS);
return set;
}
Aggregations