[ 
https://issues.apache.org/jira/browse/HDFS-10918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15531394#comment-15531394
 ] 

Andrew Wang commented on HDFS-10918:
------------------------------------

I think we still are missing handling relative paths and symlinks. Let's look 
at getFileStatus:

{code}
  public FileStatus getFileStatus(Path f) throws IOException {
    Path absF = fixRelativePart(f); // <----------- uses the CWD to turn 
relative into absolute paths
    return new FileSystemLinkResolver<FileStatus>() { // <------- class to keep 
following symlinks until path is fully resolved
      @Override
      public FileStatus doCall(final Path p) throws IOException {
        HdfsFileStatus fi = dfs.getFileInfo(getPathName(p));
        if (fi != null) {
          return fi.makeQualified(getUri(), p);
        } else {
          throw new FileNotFoundException("File does not exist: " + p);
        }
      }
      @Override
      public FileStatus next(final FileSystem fs, final Path p)
          throws IOException {
        return fs.getFileStatus(p);
      }
    }.resolve(this, absF);
  }
{code}

Looking at this more closely myself, code sharing is pretty tough because we 
need that HdfsFileStatus which is only returned by an HDFS. There are other 
examples of ops that can only resolve symlinks through a DFS instance, e.g. 
{{renameSnapshot}}, that you can use as an example.

> Add a tool to get FileEncryptionInfo from CLI
> ---------------------------------------------
>
>                 Key: HDFS-10918
>                 URL: https://issues.apache.org/jira/browse/HDFS-10918
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>          Components: encryption
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>         Attachments: HDFS-10918.01.patch, HDFS-10918.02.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to