kaijchen commented on code in PR #537:
URL: https://github.com/apache/incubator-uniffle/pull/537#discussion_r1093964688


##########
storage/src/main/java/org/apache/uniffle/storage/handler/impl/LocalFileWriteHandler.java:
##########
@@ -51,19 +53,10 @@ public LocalFileWriteHandler(
   }
 
   private void createBasePath() {
-    File baseFolder = new File(basePath);
-    // check if shuffle folder exist
-    if (!baseFolder.exists()) {
-      try {
-        // try to create folder, it may be created by other Shuffle Server
-        baseFolder.mkdirs();
-      } catch (SecurityException e) {
-        // if folder exist, ignore the exception
-        if (!baseFolder.exists()) {
-          LOG.error("Can't create shuffle folder:" + basePath, e);
-          throw e;
-        }
-      }
+    try {
+      Files.createDirectories(Paths.get(basePath));

Review Comment:
   > Yeah. but there's q shortcut, if the dir is already existed, we don't have 
to invoke `createDirectories`, which seems quite complex compared to check the 
existence of dir.
   
   If there will be a significant performance difference, why doesn't the 
library author do this in the `createDirectories`?
   Even if it can improve the case when the dir already exists, it will worsen 
the case when the dir doesn't exist.



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