ayushtkn commented on code in PR #5990:
URL: https://github.com/apache/hive/pull/5990#discussion_r2234915947


##########
common/src/java/org/apache/hadoop/hive/common/FileUtils.java:
##########
@@ -830,7 +830,14 @@ public static boolean copy(FileSystem srcFS, Path[] srcs, 
FileSystem dstFS, Path
           throw new IOException("copying multiple files, but last argument `" 
+ dst + "' is not a directory");
         }
       } catch (FileNotFoundException var16) {
-        throw new IOException("`" + dst + "': specified destination directory 
does not exist", var16);
+        // Create a new FileNotFoundException with the custom message and the 
original message
+        FileNotFoundException e = new FileNotFoundException("'" + dst + "': 
specified destination directory does not exist");

Review Comment:
   Mostly these copy functions are used by replication for data copy, but I 
think they got used somewhere else as well. But this method I remember was 
written for copying with Preserving Xattrs during Replication. Ideally we 
should not catch FNF just let it propagate back to the client rather than 
wrapping it in IOE. It shouldn't by incompatible FNF is a child class of IOE.
   
   But if think there can be issues in that case @harshal-16 maybe the 
CopyUtils.retryableFxn() can be improved as well. 
   
   Maybe something like
   ```
     private void isNonRetryableException(Exception e) throws IOException {
       Throwable current = e;
       while (current != null) {
         final Throwable curr = current;
         if (failOnParentExceptionList.stream().anyMatch(k -> 
k.isAssignableFrom(curr.getClass()))) {
           throw new IOException(e);
         }
         current = current.getCause();
       }
     }
   ```
   
   or maybe use ExceptionUtils.getRootCause(e)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to