[ https://issues.apache.org/jira/browse/HDFS-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979219#comment-13979219 ]
Tsz Wo Nicholas Sze commented on HDFS-6266: ------------------------------------------- Question: Suppose there is a file /dir/foo, where dir is snapshottable. Then, create snapshot s1, s2 and s3 so that foo is in all three snapshots. Now delete foo and then create snapshot s4. If we call getPathComponentsWithSnapshot(foo), it will return /dir/.snapshot/s3/foo. Why not returning /dir/.snapshot/s1/foo (or s2)? Would it work for computing snapshot diff between s4 and s2? Other comments - In the code below, even if sid is CURRENT_STATE_ID, inSnapshot will be set to true. I guess it probably is not a bug since you have tests covering it. Maybe we should rename the variable inSnapshot? Or, could we add "&& sid != Snapshot.CURRENT_STATE_ID" to the if-statement below? {code} int sid = parent.asDirectory().searchChild(inode); Preconditions.checkState(sid != Snapshot.NO_SNAPSHOT_ID); if (snapshotId == Snapshot.CURRENT_STATE_ID) { snapshotId = sid; inSnapshot = true; } {code} - We should add snapshotId != Snapshot.CURRENT_STATE_ID to the if-statement below. {code} if (inode instanceof INodeDirectory && inode.asDirectory().isSnapshottable() && inSnapshot) { ... } {code} - getPathComponentsWithSnapshot should be static - findINodeInSnapshot actaully is finding snapshot, how about renaming it to something like "findSnapshotDeleted"? > Identify full path for a given INode > ------------------------------------ > > Key: HDFS-6266 > URL: https://issues.apache.org/jira/browse/HDFS-6266 > Project: Hadoop HDFS > Issue Type: Improvement > Components: snapshots > Reporter: Jing Zhao > Assignee: Jing Zhao > Attachments: HDFS-6266.000.patch > > > Currently when identifying the full path of a given inode, > FSDirectory#getPathComponents and FSDirectory#getFullPathName can only handle > normal cases where the inode and its ancestors are not in any snapshot. This > jira aims to provide support to handle snapshots. This can be useful for > identifying the "Rename" change in a snapshot diff report. -- This message was sent by Atlassian JIRA (v6.2#6252)