[ https://issues.apache.org/jira/browse/HDFS-16972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17713179#comment-17713179 ]
ASF GitHub Bot commented on HDFS-16972: --------------------------------------- szetszwo commented on code in PR #5532: URL: https://github.com/apache/hadoop/pull/5532#discussion_r1168961332 ########## hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeReference.java: ########## @@ -35,32 +35,45 @@ import org.apache.hadoop.security.AccessControlException; /** - * An anonymous reference to an inode. - * + * A reference to an inode. + * <p> * This class and its subclasses are used to support multiple access paths. * A file/directory may have multiple access paths when it is stored in some - * snapshots and it is renamed/moved to other locations. - * + * snapshots, and it is renamed/moved to other locations. + * <p> * For example, - * (1) Suppose we have /abc/foo, say the inode of foo is inode(id=1000,name=foo) - * (2) create snapshot s0 for /abc + * (1) Suppose we have /abc/foo and the inode is inode(id=1000,name=foo). + * Suppose foo is created after snapshot s0, + * i.e. foo is not in s0 and inode(id=1000,name=foo) + * is in the create-list of /abc for the s0 diff entry. + * (2) Create snapshot s1, s2 for /abc, i.e. foo is in s1 and s2. + * Suppose sDst is the last snapshot /xyz. * (3) mv /abc/foo /xyz/bar, i.e. inode(id=1000,name=...) is renamed from "foo" * to "bar" and its parent becomes /xyz. - * - * Then, /xyz/bar and /abc/.snapshot/s0/foo are two different access paths to - * the same inode, inode(id=1000,name=bar). - * + * <p> + * Then, /xyz/bar, /abc/.snapshot/s1/foo and /abc/.snapshot/s2/foo + * are different access paths to the same inode, inode(id=1000,name=bar). + * <p> * With references, we have the following - * - /abc has a child ref(id=1001,name=foo). - * - /xyz has a child ref(id=1002) - * - Both ref(id=1001,name=foo) and ref(id=1002) point to another reference, - * ref(id=1003,count=2). - * - Finally, ref(id=1003,count=2) points to inode(id=1000,name=bar). - * - * Note 1: For a reference without name, e.g. ref(id=1002), it uses the name - * of the referred inode. + * - The source /abc/foo inode(id=1000,name=foo) is replaced with + * a WithName(name=foo,lastSnapshot=s2) and then it is moved + * to the delete-list of /abc for the s2 diff entry. + * The replacement also replaces inode(id=1000,name=foo) + * in the create-list of /abc for the s0 diff entry with the WithName. + * The same as before, /abc/foo is in s1 and s2, but not in s0. + * - The destination /xyz adds a child DstReference(dstSnapshot=sDst). + * DstReference is added to the create-list of /xyz for the sDst diff entry. + * /abc/bar is not in sDst. Review Comment: Oops, it is a typo > Delete a snapshot may deleteCurrentFile > --------------------------------------- > > Key: HDFS-16972 > URL: https://issues.apache.org/jira/browse/HDFS-16972 > Project: Hadoop HDFS > Issue Type: Bug > Components: snapshots > Reporter: Tsz-wo Sze > Assignee: Tsz-wo Sze > Priority: Major > Labels: pull-request-available > > We found one case the when deleting a snapshot (with ordered snapshot > deletion disabled), it can incorrectly delete some files in the current state. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org