private static void validateRenameSource(FSDirectory fsd, INodesInPath srcIIP) throws IOException { String error; final INode srcInode = srcIIP.getLastINode(); // validate source if (srcInode == null) { error = "rename source " + srcIIP.getPath() + " is not found."; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new FileNotFoundException(error); } if (srcIIP.length() == 1) { error = "rename source cannot be the root"; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new IOException(error); } // srcInode and its subtree cannot contain snapshottable directories with // snapshots FSDirSnapshotOp.checkSnapshot(fsd, srcIIP, null); }
/** * Check if the given path (or one of its descendants) is snapshottable and * already has snapshots. * * @param fsd the FSDirectory * @param iip inodes of the path * @param snapshottableDirs The list of directories that are snapshottable * but do not have snapshots yet */ static void checkSnapshot(FSDirectory fsd, INodesInPath iip, List<INodeDirectory> snapshottableDirs) throws SnapshotException { // avoid the performance penalty of recursing the tree if snapshots // are not in use SnapshotManager sm = fsd.getFSNamesystem().getSnapshotManager(); if (sm.getNumSnapshottableDirs() > 0) { checkSnapshot(iip.getLastINode(), snapshottableDirs); } } }
checkSnapshot(child, snapshottableDirs);
if (dstInode != null) { // Destination exists validateOverwrite(src, dst, overwrite, srcInode, dstInode); FSDirSnapshotOp.checkSnapshot(fsd, dstIIP, snapshottableDirs);
if (deleteAllowed(iip)) { List<INodeDirectory> snapshottableDirs = new ArrayList<>(); FSDirSnapshotOp.checkSnapshot(fsd, iip, snapshottableDirs); ReclaimContext context = new ReclaimContext( fsd.getBlockStoragePolicySuite(), collectedBlocks, removedINodes,
FSDirSnapshotOp.checkSnapshot(fsd, iip, snapshottableDirs); boolean filesRemoved = unprotectedDelete(fsd, iip, new ReclaimContext(fsd.getBlockStoragePolicySuite(),
private static void validateRenameSource(INodesInPath srcIIP) throws IOException { String error; final INode srcInode = srcIIP.getLastINode(); // validate source if (srcInode == null) { error = "rename source " + srcIIP.getPath() + " is not found."; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new FileNotFoundException(error); } if (srcIIP.length() == 1) { error = "rename source cannot be the root"; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new IOException(error); } // srcInode and its subtree cannot contain snapshottable directories with // snapshots FSDirSnapshotOp.checkSnapshot(srcInode, null); }
private static void validateRenameSource(INodesInPath srcIIP) throws IOException { String error; final INode srcInode = srcIIP.getLastINode(); // validate source if (srcInode == null) { error = "rename source " + srcIIP.getPath() + " is not found."; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new FileNotFoundException(error); } if (srcIIP.length() == 1) { error = "rename source cannot be the root"; NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " + error); throw new IOException(error); } // srcInode and its subtree cannot contain snapshottable directories with // snapshots FSDirSnapshotOp.checkSnapshot(srcInode, null); }
} else { List<INodeDirectory> snapshottableDirs = new ArrayList<>(); FSDirSnapshotOp.checkSnapshot(iip.getLastINode(), snapshottableDirs); filesRemoved = unprotectedDelete(fsd, iip, collectedBlocks, removedINodes, mtime);
checkSnapshot(child, snapshottableDirs);
checkSnapshot(child, snapshottableDirs);
if (dstInode != null) { // Destination exists validateOverwrite(src, dst, overwrite, srcInode, dstInode); FSDirSnapshotOp.checkSnapshot(dstInode, snapshottableDirs);
} else { List<INodeDirectory> snapshottableDirs = new ArrayList<>(); FSDirSnapshotOp.checkSnapshot(iip.getLastINode(), snapshottableDirs); filesRemoved = unprotectedDelete(fsd, iip, collectedBlocks, removedINodes, mtime);
FSDirSnapshotOp.checkSnapshot(iip.getLastINode(), snapshottableDirs); long filesRemoved = unprotectedDelete( fsd, iip, collectedBlocks, removedINodes, mtime);
FSDirSnapshotOp.checkSnapshot(iip.getLastINode(), snapshottableDirs); long filesRemoved = unprotectedDelete( fsd, iip, collectedBlocks, removedINodes, mtime);
if (dstInode != null) { // Destination exists validateOverwrite(src, dst, overwrite, srcInode, dstInode); FSDirSnapshotOp.checkSnapshot(dstInode, snapshottableDirs);