homatthew commented on a change in pull request #3477:
URL: https://github.com/apache/gobblin/pull/3477#discussion_r836898574



##########
File path: 
gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java
##########
@@ -307,10 +303,20 @@ public static void 
mkdirsWithRecursivePermissionWithRetry(final FileSystem fs, f
         throw new IOException("Path " + path + "does not exist however it 
should. Giving up..."+ e);
       }
     }
+  }
+
+  private static void gobblinMkDirs(final FileSystem fs, final Path path, 
FsPermission perm) throws IOException {
+    Set<Path> parentsThatDidntExistBefore = new HashSet<>();
+    for (Path p = path.getParent(); p != null && !fs.exists(p); p = 
p.getParent()) {
+      parentsThatDidntExistBefore.add(p);
+    }
+
+    if (!FileSystem.mkdirs(fs, path, perm)) {
+      throw new IOException(String.format("Unable to mkdir %s with permission 
%s", path, perm));
+    }
 
-    // Double check permission, since fs.mkdirs() may not guarantee to set the 
permission correctly

Review comment:
       FYI, this comment refers to the fact that fs mkdirs uses a umask to set 
the permission, so it may not be the exact permission that you specified.
   
   It is recommended to use FileSystem.mkdirs if you want to ignore the umask.




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


Reply via email to