You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/05 23:49:31 UTC

[GitHub] [spark] HeartSaVioR commented on a change in pull request #28997: [SPARK-32172][CORE]Use createDirectory instead of mkdir

HeartSaVioR commented on a change in pull request #28997:
URL: https://github.com/apache/spark/pull/28997#discussion_r449932500



##########
File path: core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
##########
@@ -69,9 +70,7 @@ private[spark] class DiskBlockManager(conf: SparkConf, deleteFilesOnStop: Boolea
         old
       } else {
         val newDir = new File(localDirs(dirId), "%02x".format(subDirId))
-        if (!newDir.exists() && !newDir.mkdir()) {
-          throw new IOException(s"Failed to create local dir in $newDir.")
-        }
+        Files.createDirectory(newDir.toPath)

Review comment:
       Yeah, either `exists()` -> `Files.createDirectory` or just `Files.createDirectories` would do the trick. The side-effect of latter is that it would also create non-existence parent directories.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org