Giovanni Matteo Fumarola commented on HADOOP-15465:

Thanks [~ste...@apache.org] for the review.

I had the same thought about the failure to symlink and this is the analysis I 

Right now we have 3 possible callers, each of them have different behaviors in 
case of failure. {{RawLocalFileSystem}} throws an IOException. 
\{{LocalDistributedCache}} logs a warning, while the caller 
{{DefaultContainerExecutor}} does not react.

*Currently* WinUtils (in Windows) / ln (in Unix) can return 0 on success and 1 
on failure. In a specific security case, WinUtils can return 2.
In a case of either one of those throws an IOException, the code logs and 
rethrows it.

From [Oracle Files 

CreateSymbolicLink returns the path to the symbolic link and it can throws:
 - if the implementation does not support symbolic links or the array contains 
an attribute that cannot be set atomically when creating the symbolic link;
 - if a file with the name already exists _(optional specific exception);_
 - if an I/O error occurs;
 - In the case of the default provider, and a security manager is installed, it 
 or its 
 method denies write access to the path of the symbolic link.

I did not find any references to it but I suppose {{CreateSymbolicLink}} can 
succeed or can throw an exception and it cannot return null on failure.

In the *new code*, in case of SecurityException, it returns 2 in both 
environments (Win and Unix).
In case of IOException, it logs and rethrows it - as it is happening in the 
current code.
My only concerns are about FileAlreadyExists and UnsupportedOperation. We 
should catch and return 1.


> Deprecate WinUtils#Symlinks by using native java code
> -----------------------------------------------------
>                 Key: HADOOP-15465
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15465
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: Giovanni Matteo Fumarola
>            Priority: Major
>         Attachments: HADOOP-15465.v0.patch, HADOOP-15465.v0.proto.patch, 
> HADOOP-15465.v1.patch, HADOOP-15465.v2.patch
> Hadoop uses the shell to create symbolic links. Now that Hadoop relies on 
> Java 7+, we can deprecate all the shell code and rely on the Java APIs.

This message was sent by Atlassian JIRA

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

Reply via email to