diff options
author | Matei Zaharia <matei@eecs.berkeley.edu> | 2012-10-01 15:55:16 -0700 |
---|---|---|
committer | Matei Zaharia <matei@eecs.berkeley.edu> | 2012-10-01 15:55:16 -0700 |
commit | b9fb8d6463a84072783e10b7e531aa389f73c82d (patch) | |
tree | 883389e26758a22cf6f4a5a1bf7c2693b686fe5d /core/src/main | |
parent | bc881e479884b3cd19720b9fdc6ac24baa004c90 (diff) | |
download | spark-b9fb8d6463a84072783e10b7e531aa389f73c82d.tar.gz spark-b9fb8d6463a84072783e10b7e531aa389f73c82d.tar.bz2 spark-b9fb8d6463a84072783e10b7e531aa389f73c82d.zip |
Include date in folder name for Spark local dir.
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/spark/storage/DiskStore.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/src/main/scala/spark/storage/DiskStore.scala b/core/src/main/scala/spark/storage/DiskStore.scala index e198813456..d9965f4306 100644 --- a/core/src/main/scala/spark/storage/DiskStore.scala +++ b/core/src/main/scala/spark/storage/DiskStore.scala @@ -4,9 +4,9 @@ import java.nio.ByteBuffer import java.io.{File, FileOutputStream, RandomAccessFile} import java.nio.channels.FileChannel.MapMode import it.unimi.dsi.fastutil.io.FastBufferedOutputStream -import java.util.UUID +import java.util.{Random, Date} import spark.Utils -import java.nio.channels.FileChannel +import java.text.SimpleDateFormat /** * Stores BlockManager blocks on disk. @@ -130,16 +130,18 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String) private def createLocalDirs(): Array[File] = { logDebug("Creating local directories at root dirs '" + rootDirs + "'") + val dateFormat = new SimpleDateFormat("yyyyMMddHHmmss") rootDirs.split(",").map(rootDir => { var foundLocalDir: Boolean = false var localDir: File = null - var localDirUuid: UUID = null + var localDirId: String = null var tries = 0 + val rand = new Random() while (!foundLocalDir && tries < MAX_DIR_CREATION_ATTEMPTS) { tries += 1 try { - localDirUuid = UUID.randomUUID() - localDir = new File(rootDir, "spark-local-" + localDirUuid) + localDirId = "%s-%04x".format(dateFormat.format(new Date), rand.nextInt(65536)) + localDir = new File(rootDir, "spark-local-" + localDirId) if (!localDir.exists) { localDir.mkdirs() foundLocalDir = true |