aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authoryantangzhai <tyz0303@163.com>2014-07-03 10:14:35 -0700
committerAaron Davidson <aaron@databricks.com>2014-07-03 10:14:35 -0700
commit3bbeca648985b32bdf1eedef779cb2817eb6dfa4 (patch)
treea20cd91074d24356929a41531c9ee4a55ba862e2 /core/src
parentbc7041a42dfa84312492ea8cae6fdeaeac4f6d1c (diff)
downloadspark-3bbeca648985b32bdf1eedef779cb2817eb6dfa4.tar.gz
spark-3bbeca648985b32bdf1eedef779cb2817eb6dfa4.tar.bz2
spark-3bbeca648985b32bdf1eedef779cb2817eb6dfa4.zip
[SPARK-2324] SparkContext should not exit directly when spark.local.dir is a list of multiple paths and one of them has error
The spark.local.dir is configured as a list of multiple paths as follows /data1/sparkenv/local,/data2/sparkenv/local. If the disk data2 of the driver node has error, the application will exit since DiskBlockManager exits directly at createLocalDirs. If the disk data2 of the worker node has error, the executor will exit either. DiskBlockManager should not exit directly at createLocalDirs if one of spark.local.dir has error. Since spark.local.dir has multiple paths, a problem should not affect the overall situation. I think DiskBlockManager could ignore the bad directory at createLocalDirs. Author: yantangzhai <tyz0303@163.com> Closes #1274 from YanTangZhai/SPARK-2324 and squashes the following commits: 609bf48 [yantangzhai] [SPARK-2324] SparkContext should not exit directly when spark.local.dir is a list of multiple paths and one of them has error df08673 [yantangzhai] [SPARK-2324] SparkContext should not exit directly when spark.local.dir is a list of multiple paths and one of them has error
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala b/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
index 2ec46d416f..673fc19c06 100644
--- a/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
+++ b/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
@@ -44,6 +44,10 @@ private[spark] class DiskBlockManager(shuffleManager: ShuffleBlockManager, rootD
* directory, create multiple subdirectories that we will hash files into, in order to avoid
* having really large inodes at the top level. */
private val localDirs: Array[File] = createLocalDirs()
+ if (localDirs.isEmpty) {
+ logError("Failed to create any local dir.")
+ System.exit(ExecutorExitCode.DISK_STORE_FAILED_TO_CREATE_DIR)
+ }
private val subDirs = Array.fill(localDirs.length)(new Array[File](subDirsPerLocalDir))
private var shuffleSender : ShuffleSender = null
@@ -116,7 +120,7 @@ private[spark] class DiskBlockManager(shuffleManager: ShuffleBlockManager, rootD
private def createLocalDirs(): Array[File] = {
logDebug(s"Creating local directories at root dirs '$rootDirs'")
val dateFormat = new SimpleDateFormat("yyyyMMddHHmmss")
- rootDirs.split(",").map { rootDir =>
+ rootDirs.split(",").flatMap { rootDir =>
var foundLocalDir = false
var localDir: File = null
var localDirId: String = null
@@ -136,11 +140,13 @@ private[spark] class DiskBlockManager(shuffleManager: ShuffleBlockManager, rootD
}
}
if (!foundLocalDir) {
- logError(s"Failed $MAX_DIR_CREATION_ATTEMPTS attempts to create local dir in $rootDir")
- System.exit(ExecutorExitCode.DISK_STORE_FAILED_TO_CREATE_DIR)
+ logError(s"Failed $MAX_DIR_CREATION_ATTEMPTS attempts to create local dir in $rootDir." +
+ " Ignoring this directory.")
+ None
+ } else {
+ logInfo(s"Created local directory at $localDir")
+ Some(localDir)
}
- logInfo(s"Created local directory at $localDir")
- localDir
}
}