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_r339301111
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
##########
@@ -574,7 +580,28 @@ 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, 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 have snapshottable descendant directories.
Review comment:
If any of the descendants dirs got some snapshot,
`FSDirRenameOp#validateRenameSource` will finally call
`FSDirSnapshotOp#checkSnapshot` and throw `SnapshotException`. And this check
happens before this one.
----------------------------------------------------------------
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]