Skip to content

Commit c762877

Browse files
XuTingjunJoshRosen
authored andcommitted
[SPARK-4792] Add error message when making local dir unsuccessfully
Author: meiyoula <[email protected]> Closes apache#3635 from XuTingjun/master and squashes the following commits: dd1c66d [meiyoula] when old is deleted, it will throw an exception where call it 2a55bc2 [meiyoula] Update DiskBlockManager.scala 1483a4a [meiyoula] Delete multiple retries to make dir 67f7902 [meiyoula] Try some times to make dir maybe more reasonable 1c51a0c [meiyoula] Update DiskBlockManager.scala
1 parent 81112e4 commit c762877

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.spark.storage
1919

20-
import java.io.File
20+
import java.io.{IOException, File}
2121
import java.text.SimpleDateFormat
2222
import java.util.{Date, Random, UUID}
2323

@@ -71,7 +71,9 @@ private[spark] class DiskBlockManager(blockManager: BlockManager, conf: SparkCon
7171
old
7272
} else {
7373
val newDir = new File(localDirs(dirId), "%02x".format(subDirId))
74-
newDir.mkdir()
74+
if (!newDir.exists() && !newDir.mkdir()) {
75+
throw new IOException(s"Failed to create local dir in $newDir.")
76+
}
7577
subDirs(dirId)(subDirId) = newDir
7678
newDir
7779
}

0 commit comments

Comments
 (0)