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 2022/11/03 16:49:32 UTC

[GitHub] [spark] mridulm commented on a diff in pull request #38467: [SPARK-40987][CORE] Avoid creating a directory when deleting a block, causing DAGScheduler to not work

mridulm commented on code in PR #38467:
URL: https://github.com/apache/spark/pull/38467#discussion_r1013165931


##########
core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala:
##########
@@ -115,7 +119,9 @@ private[spark] class DiskBlockManager(
             Files.setPosixFilePermissions(path, currentPerms)
           }
         }
-        subDirs(dirId)(subDirId) = newDir
+        if (newDir.exists()) {

Review Comment:
   Can we avoid multiple calls to `exists` ?
   Something like:
   ```
   val newDir = new File ...
   val alreadyExists = newDir.exists()
   if (!alreadyExists && needCreate) {
    ...
   }
   
   if (alreadyExists || needCreate) {
     subDirs(dirId) ...
   }
   
   ```
   



-- 
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: reviews-unsubscribe@spark.apache.org

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