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

Raghu Angadi updated HADOOP-1961:
---------------------------------

    Attachment: HADOOP-1961.patch

Attached patch keeps copyToLocal() in FsShell.java closer to 0.13 structure. 

Fixes following regressions : 
- copying a file with simple file name for destination as described in the 
description.
- handling of globes : {{globePath()}} was invoked late and when it returns 
just one path, treated it as non-globed path, unless the destination was a 
directory (see example in earlier comment).

Retains the following change between 0.13 and 0.14 :
- {{bin/hadoop fs -get dir1 dir2 localdir}}   # two dirs can be specified with 
a glob
-- 0.13 copies _contents_ of dir1 and dir2 into localdir
-- 0.14.x copies dir1 and dir2 into localdir (matches with regular cp)

The following behaviour is new :
- when rename() fails during the copy does not copy temp file to another temp 
file.
- {{bin/hadoop fs -get dir1 localdir}} # and localdir exists
-- 0.13 and 0.14.1 copy contents of dir1 into localdir
-- 0.14.2 copies dir1 into localdir 
-- btw, when localdir does not exist, all versions copy contents of dir1 into 
localdir.

> -get, -copyToLocal fail when  single filename is passed
> -------------------------------------------------------
>
>                 Key: HADOOP-1961
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1961
>             Project: Hadoop
>          Issue Type: Bug
>          Components: dfs
>    Affects Versions: 0.14.1
>            Reporter: Koji Noguchi
>            Assignee: Raghu Angadi
>            Priority: Blocker
>             Fix For: 0.14.2
>
>         Attachments: HADOOP-1961.patch, HADOOP-1961.patch
>
>
> In 0.14.1 and in trunk, when I try 
> % hadoop dfs -get /user/knoguchi/aaa  aaa
> get: Failed to rename tmp file to local destination "aaa".  Remote source 
> file "/user/knoguchi/aaa" is saved to "/tmp/_copyToLocal_aaa30478".
> This works. 
> % hadoop dfs -get /user/knoguchi/aaa  ./aaa
> or 
> % hadoop dfs -get /user/knoguchi/aaa   /home/knoguchi/aaa
> My guess. With change in HADOOP-1292, it now creates a tmp file when 
> -copyToLocal.
> When destination path is passed without any directory, tmp file is created 
> under '/tmp'. Otherwise, it uses the same directory as the destination path.
> In Java API for File.renameTo, 
> http://java.sun.com/javase/6/docs/api/java/io/File.html#renameTo(java.io.File)
> it says 
> " The rename operation might not be able to move a file from one filesystem 
> to another", 
> so renameTo call from /tmp/_tmpfile to /home/knoguchi can fail.

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