[ 
https://issues.apache.org/jira/browse/HADOOP-4044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637620#action_12637620
 ] 

Doug Cutting commented on HADOOP-4044:
--------------------------------------

> Another trueism is that returning unrelated values is API pollution.

Sure, but the values here are not unrelated.  They're core.

> I guess one end of the opinion is that retuning link is normal and other end 
> thinks it isn't.

Okay, so, if that's the case, how is it abnormal?  The traditional way to model 
this would be something like:
{code}
public FileHandle open(Path path) {
  for (element in path) {
    FileStatus stat = fsImpl.getStatus(element);
    if (stat.isLink()) {
      return open(stat.getLinkTarget());
    } else if stat.isFile() {
      return fsImpl.open(element);
    }
  }
{code}
I don't think anyone would argue that the values of isLink() and 
getLinkTarget() are not normal data.  But we don't want to make this many calls 
to our FS implementations, since they're RPCs.  So, for performance, we want to 
package that same data in a different way, with something like:
{code}
public FileHandle open(Path path) {
    LinkOrFileHandle linkOrFileHandle = getNextLinkOrOpen(path);
    while (linkOrFileHandle.isLink()) {
       linkOrFileHandle = getNextLinkOrOpen(linkOrFileHandle.getLink());
    }
    return linkOrFileHandle.getFileHandle();
}
{code}
Why does this suddenly make the that same data non-normal?


> Create symbolic links in HDFS
> -----------------------------
>
>                 Key: HADOOP-4044
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4044
>             Project: Hadoop Core
>          Issue Type: New Feature
>          Components: dfs
>            Reporter: dhruba borthakur
>            Assignee: dhruba borthakur
>         Attachments: symLink1.patch, symLink1.patch, symLink4.patch, 
> symLink5.patch, symLink6.patch, symLink8.patch, symLink9.patch
>
>
> HDFS should support symbolic links. A symbolic link is a special type of file 
> that contains a reference to another file or directory in the form of an 
> absolute or relative path and that affects pathname resolution. Programs 
> which read or write to files named by a symbolic link will behave as if 
> operating directly on the target file. However, archiving utilities can 
> handle symbolic links specially and manipulate them directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to