zhjwpku commented on a change in pull request #1670: HDFS-14925. Rename
operation should check nest snapshot
URL: https://github.com/apache/hadoop/pull/1670#discussion_r339853076
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
##########
@@ -574,7 +582,32 @@ private static void validateRenameSource(FSDirectory fsd,
}
// srcInode and its subtree cannot contain snapshottable directories with
// snapshots
- FSDirSnapshotOp.checkSnapshot(fsd, srcIIP, null);
+ FSDirSnapshotOp.checkSnapshot(fsd, srcIIP, snapshottableDirs);
+ }
+
+ private static void validateNestSnapshot(FSDirectory fsd, String srcPath,
+ INodeDirectory dstParent, List<INodeDirectory> snapshottableDirs)
+ throws SnapshotException {
+
+ if (fsd.getFSNamesystem().getSnapshotManager().isAllowNestedSnapshots()) {
+ return;
+ }
+
+ /*
+ * snapshottableDirs is a list of snapshottable directory (child of rename
+ * src) which do not have snapshots yet. If this list is not empty, that
+ * means rename src has snapshottable descendant directories.
+ */
+ if (snapshottableDirs != null && snapshottableDirs.size() > 0) {
Review comment:
Yes, that's it ;)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]