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

Konstantin Shvachko commented on HADOOP-4044:
---------------------------------------------

I am -1 on partial implementations, because your case of file-only symlinks can 
be handled on the application level.

In fact path resolution as Joydeep proposed can be handled outside the file 
system without checking each path component. 
We just need to throw FileNotFoundException with the exact path prefix that has 
not been found.
E.g. you want to open a file {{path = /dir0/link/dir1/file}} where {{link}} is 
a file containing a symlink {{/dir3/dir4/}}. 
If you call {{open(path)}} a {{FileNotFoundException}} will be thrown with the 
message "File is not found: {{/dir0/link/dir1/}}".
Now the application reads contents of file {{/dir0/link}}, creates a new {{path 
=  /dir3/dir4/dir1/file}}, and calls {{open(path)}} again.
An optimization to this can be that name-node throws a new 
{{DirectoryNotFoundException("Directory is not found: /dir0/link")}}
then the client knows for sure that "link" does exist, but is a file rather 
than a directory, and therefore can be a symlink.
Seems to me 
- this suites your case, 
- requires minimal changes to the fs internals and 
- does not affect existing hdfs behavior when links are not used.

> 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
>
>
> 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