/** Verify if the snapshot name is legal. */ static void verifySnapshotName(FSDirectory fsd, String snapshotName, String path) throws FSLimitException.PathComponentTooLongException { if (snapshotName.contains(Path.SEPARATOR)) { throw new HadoopIllegalArgumentException( "Snapshot name cannot contain \"" + Path.SEPARATOR + "\""); } final byte[] bytes = DFSUtil.string2Bytes(snapshotName); fsd.verifyINodeName(bytes); fsd.verifyMaxComponentLength(bytes, path); }
/** * Checks file system limits (max component length and max directory items) * during a rename operation. */ static void verifyFsLimitsForRename(FSDirectory fsd, INodesInPath srcIIP, INodesInPath dstIIP) throws PathComponentTooLongException, MaxDirectoryItemsExceededException { byte[] dstChildName = dstIIP.getLastLocalName(); final String parentPath = dstIIP.getParentPath(); fsd.verifyMaxComponentLength(dstChildName, parentPath); // Do not enforce max directory items if renaming within same directory. if (srcIIP.getINode(-2) != dstIIP.getINode(-2)) { fsd.verifyMaxDirItems(dstIIP.getINode(-2).asDirectory(), parentPath); } }
verifyMaxComponentLength(inode.getLocalNameBytes(), parentPath); verifyMaxDirItems(parent, parentPath);
/** Verify if the snapshot name is legal. */ static void verifySnapshotName(FSDirectory fsd, String snapshotName, String path) throws FSLimitException.PathComponentTooLongException { if (snapshotName.contains(Path.SEPARATOR)) { throw new HadoopIllegalArgumentException( "Snapshot name cannot contain \"" + Path.SEPARATOR + "\""); } final byte[] bytes = DFSUtil.string2Bytes(snapshotName); fsd.verifyINodeName(bytes); fsd.verifyMaxComponentLength(bytes, path); }
/** Verify if the snapshot name is legal. */ static void verifySnapshotName(FSDirectory fsd, String snapshotName, String path) throws FSLimitException.PathComponentTooLongException { if (snapshotName.contains(Path.SEPARATOR)) { throw new HadoopIllegalArgumentException( "Snapshot name cannot contain \"" + Path.SEPARATOR + "\""); } final byte[] bytes = DFSUtil.string2Bytes(snapshotName); fsd.verifyINodeName(bytes); fsd.verifyMaxComponentLength(bytes, path); }
/** * Checks file system limits (max component length and max directory items) * during a rename operation. */ static void verifyFsLimitsForRename(FSDirectory fsd, INodesInPath srcIIP, INodesInPath dstIIP) throws PathComponentTooLongException, MaxDirectoryItemsExceededException { byte[] dstChildName = dstIIP.getLastLocalName(); final String parentPath = dstIIP.getParentPath(); fsd.verifyMaxComponentLength(dstChildName, parentPath); // Do not enforce max directory items if renaming within same directory. if (srcIIP.getINode(-2) != dstIIP.getINode(-2)) { fsd.verifyMaxDirItems(dstIIP.getINode(-2).asDirectory(), parentPath); } }
/** * Checks file system limits (max component length and max directory items) * during a rename operation. */ static void verifyFsLimitsForRename(FSDirectory fsd, INodesInPath srcIIP, INodesInPath dstIIP) throws PathComponentTooLongException, MaxDirectoryItemsExceededException { byte[] dstChildName = dstIIP.getLastLocalName(); final String parentPath = dstIIP.getParentPath(); fsd.verifyMaxComponentLength(dstChildName, parentPath); // Do not enforce max directory items if renaming within same directory. if (srcIIP.getINode(-2) != dstIIP.getINode(-2)) { fsd.verifyMaxDirItems(dstIIP.getINode(-2).asDirectory(), parentPath); } }
verifyMaxComponentLength(inode.getLocalNameBytes(), parentPath); verifyMaxDirItems(parent, parentPath);
verifyMaxComponentLength(inode.getLocalNameBytes(), parentPath); verifyMaxDirItems(parent, parentPath);