[
https://issues.apache.org/jira/browse/HDFS-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jing Zhao updated HDFS-6266:
----------------------------
Attachment: HDFS-6266.001.patch
Thanks for the review, Nicholas! Update the patch to address your comments.
bq. Why not returning /dir/.snapshot/s1/foo (or s2)? Would it work for
computing snapshot diff between s4 and s2?
The main reason to return the latest snapshot is to make it consistent with the
the scenario where the file/dir is still in the current fsdir. In the later
scenario, we may want to return a non-snapshot path in most of the cases, which
means we select the latest time frame for this inode.
To compute snapshot diff between s4 and s2 does not require this functionality,
since in the diff report we will show /dir/foo got deleted. The main use case
of this functionality is that when /dir/foo got renamed to /dir/bar, we want to
figure out the path for the corresponding DstReference node. The current patch
returns /dir/bar if the path still stands. If /dir/bar got renamed or deleted,
directly calling getPathComponentsWithSnapshot will return a snapshot path. But
in diff report we may still want to show /dir/bar as the target for this rename
operation. This is because if the change on /dir/bar happened after s4, we do
not need to capture it in the snapshot diff. If the change happened before s4,
we can have another diff entry to capture the change on /dir/bar. I think maybe
we can handle this part in a separate patch when supporting rename in snapshot
diff. But maybe currently to return the latest snapshot (or time frame) is fine.
bq. could we add "&& sid != Snapshot.CURRENT_STATE_ID" to the if-statement
below?
Yes, actually I missed this part but the bug got covered by the extra check
when adding .snapshot/snapshotname to the path.
> 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, HDFS-6266.001.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)