@Override public Iterator<String> resolveChunks(String blobId) throws IOException { return delegate.resolveChunks(blobId); }
Iterator<String> idIter = blobStore.resolveChunks(blobId); final Joiner delimJoiner = Joiner.on(DELIM).skipNulls(); Iterator<List<String>> partitions = Iterators.partition(idIter, getBatchCount());
Iterator<String> idIter = blobStore.resolveChunks(blobId); final Joiner delimJoiner = Joiner.on(DELIM).skipNulls(); Iterator<List<String>> partitions = Iterators.partition(idIter, getBatchCount());
Iterator<String> idIter = blobStore.resolveChunks(blobId); final Joiner delimJoiner = Joiner.on(DELIM).skipNulls(); Iterator<List<String>> partitions = Iterators.partition(idIter, getBatchCount());
protected Set<String> createBlobs(GarbageCollectableBlobStore blobStore, int count, int size) throws Exception { HashSet<String> blobSet = new HashSet<String>(); for (int i = 0; i < count; i++) { String id = blobStore.writeBlob(randomStream(10 + i, size)); Iterator<String> idIter = blobStore.resolveChunks(id); while (idIter.hasNext()) { String chunk = idIter.next(); blobSet.add(chunk); } } log.info("{} Additional created {}", blobSet.size(), blobSet); return blobSet; }
private Set<String> createArtifacts() throws Exception { Set<String> ids = Sets.newHashSet(); int number = 10; for (int i = 0; i < number; i++) { String id = store.writeBlob(randomStream(i, getArtifactSize())); Iterator<String> iter = store.resolveChunks(id.toString()); while (iter.hasNext()) { ids.add(iter.next()); } } return ids; }
@Override public String writeBlob(InputStream in, BlobOptions options) throws IOException { String blobId = delegate.writeBlob(in, options); numChunks += Iterators.size(delegate.resolveChunks(blobId)); return blobId; }
List<String> chunkIds = Lists.newArrayList(blobStore.resolveChunks(deletedBlobId)); if (chunkIds.size() > 0) { long deleted = blobStore.countDeleteChunks(chunkIds, 0);
@Override public String writeBlob(String tempFileName) throws IOException { String blobId = delegate.writeBlob(tempFileName); numChunks += Iterators.size(delegate.resolveChunks(blobId)); return blobId; }
@Override public String writeBlob(InputStream in) throws IOException { String blobId = delegate.writeBlob(in); numChunks += Iterators.size(delegate.resolveChunks(blobId)); return blobId; }
@Test public void deleteUpdatedBlob() throws Exception { String id = store.writeBlob(randomStream(0, getArtifactSize())); Thread.sleep(100); long beforeUpdateTime = System.currentTimeMillis(); Thread.sleep(1000); // Should update the timestamp String id2 = store.writeBlob(randomStream(0, getArtifactSize())); assertEquals(id, id2); Set<String> chunks = Sets.newHashSet(); Iterator<String> iter = store.resolveChunks(id.toString()); while (iter.hasNext()) { chunks.add(iter.next()); } long count = store.countDeleteChunks(Lists.newArrayList(chunks), beforeUpdateTime); assertEquals("Deleted updated blobs", 0, count); }
private HashSet<String> createAdditional() throws Exception { HashSet<String> blobSet = new HashSet<String>(); NodeBuilder a = nodeStore.getRoot().builder(); int number = 5; for (int i = 0; i < number; i++) { SegmentBlob b = (SegmentBlob) nodeStore.createBlob(randomStream(100 + i, 16516)); a.child("cafter" + i).setProperty("x", b); Iterator<String> idIter = ((GarbageCollectableBlobStore) blobStore).resolveChunks(b.getBlobId()); while (idIter.hasNext()) { String chunk = idIter.next(); blobSet.add(chunk); } } log.info("{} Additional created {}", blobSet.size(), blobSet); nodeStore.merge(a, EmptyHook.INSTANCE, CommitInfo.EMPTY); return blobSet; } }
private HashSet<String> addNodeSpecialChars() 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(); for (int i = 0; i < specialCharSets.size(); i++) { Blob b = ds.createBlob(randomStream(i, 18432)); NodeBuilder n = a.child("cspecial"); n.child(specialCharSets.get(i)).setProperty("x", b); Iterator<String> idIter = ((GarbageCollectableBlobStore) ds.getBlobStore()) .resolveChunks(b.toString()); set.addAll(Lists.newArrayList(idIter)); } ds.merge(a, EmptyHook.INSTANCE, CommitInfo.EMPTY); return set; }
private HashSet<String> addNodeSpecialChars() throws Exception { List<String> specialCharSets = Lists.newArrayList("q\\%22afdg\\%22", "a\nbcd", "a\n\rabcd", "012\\efg" ); DocumentNodeStore ds = mk.getNodeStore(); HashSet<String> set = new HashSet<String>(); NodeBuilder a = ds.getRoot().builder(); for (int i = 0; i < specialCharSets.size(); i++) { Blob b = ds.createBlob(randomStream(i, 18432)); NodeBuilder n = a.child("cspecial"); n.child(specialCharSets.get(i)).setProperty("x", b); Iterator<String> idIter = ((GarbageCollectableBlobStore) ds.getBlobStore()) .resolveChunks(b.toString()); set.addAll(Lists.newArrayList(idIter)); } ds.merge(a, EmptyHook.INSTANCE, CommitInfo.EMPTY); return set; }
public HashSet<String> createAdditional() throws Exception { HashSet<String> blobSet = new HashSet<String>(); DocumentNodeStore s = mk.getNodeStore(); NodeBuilder a = s.getRoot().builder(); int number = 5; for (int i = 0; i < number; i++) { Blob b = s.createBlob(randomStream(100 + i, 16516)); a.child("cafter" + i).setProperty("x", b); Iterator<String> idIter = ((GarbageCollectableBlobStore) s.getBlobStore()) .resolveChunks(b.toString()); while (idIter.hasNext()) { String chunk = idIter.next(); blobSet.add(chunk); } } log.info("{} Additional created {}", blobSet.size(), blobSet); s.merge(a, EmptyHook.INSTANCE, CommitInfo.EMPTY); return blobSet; } }
Blob b = nodeStore.createBlob( randomStream(Integer.parseInt(String.valueOf(seed) + String.valueOf(i)), blobSize)); Iterator<String> idIter = blobStore.resolveChunks(b.getContentIdentity()); while (idIter.hasNext()) { String chunk = idIter.next();
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); long maxAge = 10; // minutes // 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; }
Iterator<String> idIter = ((GarbageCollectableBlobStore) ds.getBlobStore()) .resolveChunks(b.toString()); while (idIter.hasNext()) { initBlobs.add(idIter.next());
Iterator<String> idIter = ((GarbageCollectableBlobStore) s.getBlobStore()) .resolveChunks(b.toString()); while (idIter.hasNext()) { String chunk = idIter.next();
Iterator<String> idIter = ((GarbageCollectableBlobStore) s.getBlobStore()) .resolveChunks(b.toString()); while (idIter.hasNext()) { String chunk = idIter.next();