Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3635#discussion_r21871477
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala ---
    @@ -67,11 +67,13 @@ private[spark] class DiskBlockManager(blockManager: 
BlockManager, conf: SparkCon
         if (subDir == null) {
           subDir = subDirs(dirId).synchronized {
             val old = subDirs(dirId)(subDirId)
    -        if (old != null) {
    +        if (old != null && old.exists()) {
               old
             } else {
               val newDir = new File(localDirs(dirId), "%02x".format(subDirId))
    -          newDir.mkdir()
    +          if (!newDir.exists() && !newDir.mkdir()) {
    --- End diff --
    
    If execution reaches this branch, doesn't that already imply that 
`!newDir.exists()`?  Is there a reason that this patch can't be as simple as 
throwing an exception if `!newDir.mkdir()`?  After this check, `subDirs` will 
only contain the paths of directories that exist, so you won't need to perform 
a redundant `&& old.exists()` check up on line 70.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to