slfan1989 commented on code in PR #8928:
URL: https://github.com/apache/hadoop/pull/8928#discussion_r4572479717


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java:
##########
@@ -472,11 +474,17 @@ public static boolean copy(FileSystem srcFS, FileStatus 
srcStatus,
         return false;
       }
       RemoteIterator<FileStatus> contents = srcFS.listStatusIterator(src);
+      boolean copiedAll = true;
       while (contents.hasNext()) {
         FileStatus next = contents.next();
-        copy(srcFS, next, dstFS,
+        if (!copy(srcFS, next, dstFS,
             new Path(dst, next.getPath().getName()),
-            deleteSource, overwrite, conf);
+            deleteSource, overwrite, conf)) {
+          copiedAll = false;
+        }
+      }
+      if (!copiedAll) {

Review Comment:
   Thanks for fixing the source directory deletion!
   
   `FileSystem.copyToLocalFile()` currently ignores the `false` returned here, 
so `moveToLocalFile()` still returns normally when a child directory cannot be 
copied.
   
   I reproduced this with a destination that returns `false` from `mkdirs()` 
for one child. 
   
   The source file is preserved, but the destination file is missing and the 
caller sees no exception.
   
   Could we have `copyToLocalFile()` throw an `IOException` when 
`FileUtil.copy()` returns `false`, and add a regression test through 
`moveToLocalFile()`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to