if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorChildrenDiff = priorDiff.getChildrenDiff(); priorChildrenDiff.destroyCreatedList(reclaimContext, dir);
DirectoryDiff diff = diffList.get(i); SnapshotDiffSection.DirectoryDiff.Builder db = SnapshotDiffSection. DirectoryDiff.newBuilder().setSnapshotId(diff.getSnapshotId()) .setChildrenSize(diff.getChildrenSize()) .setIsSnapshotRoot(diff.isSnapshotRoot());
INodeDirectory dir) { final List<DirectoryDiff> subList = new ArrayList<>(); final int toSnapshotId = get(toIndex - 1).getSnapshotId(); for (SkipListNode current = getNode(fromIndex); current != null;) { SkipListNode next = null; new DirectoryDiff(curDiff.getSnapshotId(), dir, childrenDiff));
if (priorDiff != null && priorDiff.getSnapshotId() == prior) { List<INode> cList = priorDiff.diff.getList(ListType.CREATED); List<INode> dList = priorDiff.diff.getList(ListType.DELETED); if (priorDiff != null && priorDiff.getSnapshotId() == prior) {
DirectoryDiffList diffList = sf.getDiffs(); DirectoryDiff priorDiff = diffList.getDiffById(prior); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { List<INode> dList = priorDiff.diff.getList(ListType.DELETED); excludedNodes = cloneDiffList(dList); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorDiff.diff.destroyCreatedList(bsps, dir, collectedBlocks, removedINodes);
List<DirectoryDiff> dir1Diffs = dir1Node.getDiffs().asList(); assertEquals(1, dir1Diffs.size()); assertEquals(s1.getId(), dir1Diffs.get(0).getSnapshotId()); List<DirectoryDiff> fooDiffs = fooNode.asDirectory().getDiffs().asList(); assertEquals(1, fooDiffs.size()); assertEquals(s1.getId(), fooDiffs.get(0).getSnapshotId());
DirectoryDiff diff = diffList.get(i); SnapshotDiffSection.DirectoryDiff.Builder db = SnapshotDiffSection. DirectoryDiff.newBuilder().setSnapshotId(diff.getSnapshotId()) .setChildrenSize(diff.getChildrenSize()) .setIsSnapshotRoot(diff.isSnapshotRoot());
DirectoryDiff diff = diffList.get(i); SnapshotDiffSection.DirectoryDiff.Builder db = SnapshotDiffSection. DirectoryDiff.newBuilder().setSnapshotId(diff.getSnapshotId()) .setChildrenSize(diff.getChildrenSize()) .setIsSnapshotRoot(diff.isSnapshotRoot());
if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorChildrenDiff = priorDiff.getChildrenDiff(); counts.add(priorChildrenDiff.destroyCreatedList(bsps, dir,
assertEquals(BLOCKSIZE * 2, fileNode.computeFileSize(last.getSnapshotId())); last = dirNode.getDiffs().getLast(); assertTrue(fileNode.isWithSnapshot()); assertEquals(BLOCKSIZE * 3, fileNode.computeFileSize(last.getSnapshotId())); assertEquals(BLOCKSIZE * 3, fileNode.computeFileSize(last.getSnapshotId()));
DirectoryDiffList diffList = sf.getDiffs(); DirectoryDiff priorDiff = diffList.getDiffById(prior); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { List<INode> dList = priorDiff.diff.getList(ListType.DELETED); excludedNodes = cloneDiffList(dList); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorDiff.diff.destroyCreatedList(bsps, dir, collectedBlocks, removedINodes);
assertEquals(1, diffList.size()); Snapshot s2 = dirNode.getSnapshot(DFSUtil.string2Bytes("s2")); assertEquals(s2.getId(), diffList.get(0).getSnapshotId()); List<INode> createdList = diffList.get(0).getChildrenDiff().getList(ListType.CREATED); assertEquals(1, createdList.size());
assertEquals(1, diffList.size()); Snapshot s1 = rootNode.getSnapshot(DFSUtil.string2Bytes("s1")); assertEquals(s1.getId(), diffList.get(0).getSnapshotId());
/** * Find the corresponding snapshot whose deleted list contains the given * inode. * @return the id of the snapshot. {@link Snapshot#NO_SNAPSHOT_ID} if the * given inode is not in any of the snapshot. */ public int findSnapshotDeleted(final INode child) { final List<DirectoryDiff> diffList = asList(); for(int i = diffList.size() - 1; i >= 0; i--) { final ChildrenDiff diff = diffList.get(i).diff; final int d = diff.searchIndex(ListType.DELETED, child.getLocalNameBytes()); if (d >= 0 && diff.getList(ListType.DELETED).get(d) == child) { return diffList.get(i).getSnapshotId(); } } return Snapshot.NO_SNAPSHOT_ID; } }
/** * Check the correctness of snapshot list within snapshottable dir */ private void checkSnapshotList(INodeDirectory srcRoot, String[] sortedNames, String[] names) { assertTrue(srcRoot.isSnapshottable()); ReadOnlyList<Snapshot> listByName = srcRoot .getDirectorySnapshottableFeature().getSnapshotList(); assertEquals(sortedNames.length, listByName.size()); for (int i = 0; i < listByName.size(); i++) { assertEquals(sortedNames[i], listByName.get(i).getRoot().getLocalName()); } List<DirectoryDiff> listByTime = srcRoot.getDiffs().asList(); assertEquals(names.length, listByTime.size()); for (int i = 0; i < listByTime.size(); i++) { Snapshot s = srcRoot.getDirectorySnapshottableFeature().getSnapshotById( listByTime.get(i).getSnapshotId()); assertEquals(names[i], s.getRoot().getLocalName()); } }
/** * Find the corresponding snapshot whose deleted list contains the given * inode. * @return the id of the snapshot. {@link Snapshot#NO_SNAPSHOT_ID} if the * given inode is not in any of the snapshot. */ public int findSnapshotDeleted(final INode child) { final List<DirectoryDiff> diffList = asList(); for(int i = diffList.size() - 1; i >= 0; i--) { final ChildrenDiff diff = diffList.get(i).diff; final int d = diff.searchIndex(ListType.DELETED, child.getLocalNameBytes()); if (d >= 0 && diff.getList(ListType.DELETED).get(d) == child) { return diffList.get(i).getSnapshotId(); } } return Snapshot.NO_SNAPSHOT_ID; } }
if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorCreated = cloneDiffList(priorDiff.diff.getCreatedUnmodifiable()); priorDeleted = cloneDiffList(priorDiff.diff.getDeletedUnmodifiable()); if (priorDiff != null && priorDiff.getSnapshotId() == prior) {
DirectoryDiffList diffList = sf.getDiffs(); DirectoryDiff priorDiff = diffList.getDiffById(prior); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { List<INode> dList = priorDiff.diff.getDeletedUnmodifiable(); excludedNodes = cloneDiffList(dList); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorDiff.diff.destroyCreatedList(reclaimContext, dir);
/** * Find the corresponding snapshot whose deleted list contains the given * inode. * @return the id of the snapshot. {@link Snapshot#NO_SNAPSHOT_ID} if the * given inode is not in any of the snapshot. */ public int findSnapshotDeleted(final INode child) { final DiffList<DirectoryDiff> diffList = asList(); for(int i = diffList.size() - 1; i >= 0; i--) { final DirectoryDiff diff = diffList.get(i); if (diff.getChildrenDiff().containsDeleted(child)) { return diff.getSnapshotId(); } } return NO_SNAPSHOT_ID; }
@Override public String toString() { return diff != null ? "" + diff.getSnapshotId() : "?"; }