[ 
https://issues.apache.org/jira/browse/HADOOP-6563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eli Collins updated HADOOP-6563:
--------------------------------

    Attachment: hadoop-6563-1.patch

Attached patch adds test coverage for intermediate symlinks in paths, and fixes 
a bug these tests uncovered. 

It also adds a lot of rename unit tests so that the full set of behavior with 
symlinks, and it conforms to the posix behavior (modulo the overwrite option 
which is not present in {{rename(2)}}). Here's the current FileContext#rename 
behavior, renaming *source* to *dest* on HDFS, augmented with symlinks:

* If *source* does not exist then a FileNotFoundException is thrown.
* If *dest* does not exist then *source* is renamed *dest*. If *source* is a 
symlink then the symlink itself is renamed, not the link target.
* If *dest* exists and is a non-empty directory then an IOException is thrown.
* If *dest* exists and the OVERWRITE option is not given then an IOException is 
thrown.
* If *dest* exists and the OVERWRITE option is given then the behavior depends 
on the type of *source* and *dest*:

||Source||    Dest||    Result||
|fileA  |    fileB|     Renames *fileA* to *fileB*|
|       |     dirB|     Fails: both need to be file or directory|
|       |    linkB|     *fileA* is renamed *linkB* (regardless of what *linkB* 
points to)|
|dirA   |    fileB|     Fails: both need to be file or directory|
|       |     dirB|     Renames *dirA* to *dirB* (*dirB* is empty)|
|       |    linkB|     Fails: both need to be file or directory|
|linkA  |    fileB|     Renames *linkA* to *fileB*|
|       |     dirB|     Fails: *dirB* is a directory|
|       |    linkB|     Renames *linkA* to *linkB* (regardless of what *linkB* 
points to)|


> Add more tests to FileContextSymlinkBaseTest that cover intermediate symlinks 
> in paths
> --------------------------------------------------------------------------------------
>
>                 Key: HADOOP-6563
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6563
>             Project: Hadoop Common
>          Issue Type: Test
>          Components: fs, test
>            Reporter: Eli Collins
>            Assignee: Eli Collins
>         Attachments: hadoop-6563-1.patch
>
>
> Intermediate symlinks in paths are covered by the tests that use 
> /linkToDir/file, /linkToDir/subDir, etc  eg testCreateVia* in 
> FileContextSymlinkBaseTest. I'll add additional tests to cover other basic 
> operations on paths like /dir/linkToSomeDir/file beyond create() and open().

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