Make sense, Thanks a lot, Mingliang.  Another quick question:  why there is
a shell command that can copy a HDFS file to another  HDFS file, but there
is no API that can do this, the API only support copying file from local to
HDFS, so that I should call multiple APIs to implement this, is that
correct?  Thanks.

On Fri, May 20, 2016 at 5:44 PM, Mingliang Liu <m...@hortonworks.com> wrote:

> Kun,
>
> I think you need to be ware of the difference between client and server
> side logic. Perhaps you’re more interested in the client side in this case.
> The commands are generally running in the shell, and
> org.apache.hadoop.fs.shell package is a good place to start. Specially,
> have a look at CommandWithDestination.java.
>
> Ciao,
>
> L
>
> On May 20, 2016, at 12:05 PM, Kun Ren <ren.h...@gmail.com> wrote:
>
> Hi Genius,
>
> Currently I debugged the cp and mv operations, for example:
> (1) ./bin/hdfs dfs -cp input/a.xml input/b.xml
> (2)./bin/hdfs dfs -mv input/a.xml input/b.xml
>
> My understanding is that for operation cp, it will create a new file b.xml,
> and will copy the content of a.xml to b.xml; For mv operations, it will
> create b.xml and copy the content of a.xml to b.xml, and delete the a.xml.
>
> However, when I debug the code, i found that both operations will finally
> go through the create() method in NameNodeRpcServer.java, but I didn't see
> any calls to copy and delete function,  could you please point out to me
> where I can debug and see the full logic of the cp and mv operations.
> Thanks a lot.
>
>
>

Reply via email to