dineshchitlangia 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_r338241039
 
 

 ##########
 File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java
 ##########
 @@ -400,6 +408,13 @@ static RenameResult unprotectedRenameTo(FSDirectory fsd,
       throw new ParentNotDirectoryException(error);
     }
 
+    if (snapshottableDirs.size() > 0) {
+      if (dstParent.asDirectory().isDescendantOfSnapshotRoot()) {
+        throw new SnapshotException("Failed to rename " + src + " to " + dst +
+                " due to nested snapshottable directory");
+      }
+    }
+
 
 Review comment:
   This code snippet is written twice in same class, in different methods. Can 
we instead carve it into a method to avoid code duplication?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to