[ 
https://issues.apache.org/jira/browse/HDFS-14431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16821302#comment-16821302
 ] 

Íñigo Goiri commented on HDFS-14431:
------------------------------------

Thanks [~ayushtkn] for the comments.
Attached  [^HDFS-14431-HDFS-13891.004.patch] with the fixes.
Regarding:
{quote}
Why are we holding up the FNF Exception in Rename API and returning false, why 
aren't allowing it surface, Was it handled separately somewhere?
{quote}
This is the difference between {{ClientProtocol#rename}} and 
{{ClientProtocol#rename2}}.
{code}
  /**
   * Rename an item in the file system namespace.
   * @param src existing file or directory name.
   * @param dst new name.
   * @return true if successful, or false if the old name does not exist
   * or if the new name already belongs to the namespace.
   *
   * @throws SnapshotAccessControlException if path is in RO snapshot
   * @throws IOException an I/O error occurred
   */
  @AtMostOnce
  boolean rename(String src, String dst) throws IOException;
{code}

So there is no FileNotFoundException meanwhile:
{quote}
  /**
   * Rename src to dst.
   * @throws java.io.FileNotFoundException If <code>src</code> does not exist
   * @throws IOException If an I/O error occurred
   */
  @AtMostOnce
  void rename2(String src, String dst, Options.Rename... options)
      throws IOException;
{quote}

Then our internal method gets the FileNotFound from checking the getFileInfo so 
we need to return false and not an exception.

The part we are not covering is when the destination exists.
Let me add some there too.

> RBF: Rename with multiple subclusters should fail if no eligible locations
> --------------------------------------------------------------------------
>
>                 Key: HDFS-14431
>                 URL: https://issues.apache.org/jira/browse/HDFS-14431
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: Íñigo Goiri
>            Priority: Major
>         Attachments: HDFS-14431-HDFS-13891.001.patch, 
> HDFS-14431-HDFS-13891.002.patch, HDFS-14431-HDFS-13891.003.patch, 
> HDFS-14431-HDFS-13891.004.patch
>
>
> Currently, the rename will fail with FileNotFoundException which is not clear 
> to the user.
> The operation should fail stating the reason is that there are no eligible 
> destinations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to