aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorAaron Davidson <aaron@databricks.com>2014-01-02 13:52:35 -0800
committerAaron Davidson <aaron@databricks.com>2014-01-02 13:52:35 -0800
commit8831923219faf1599957056dd5f406a22d1f1128 (patch)
treeab9021703c244c823fc2461fa1c0d3ec641922ea /core/src
parent92c304fd0321d77941f0b029dc7b7f61804d8bca (diff)
downloadspark-8831923219faf1599957056dd5f406a22d1f1128.tar.gz
spark-8831923219faf1599957056dd5f406a22d1f1128.tar.bz2
spark-8831923219faf1599957056dd5f406a22d1f1128.zip
TempBlockId takes UUID and is explicitly non-serializable
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/org/apache/spark/storage/BlockId.scala7
-rw-r--r--core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala4
2 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/scala/org/apache/spark/storage/BlockId.scala b/core/src/main/scala/org/apache/spark/storage/BlockId.scala
index bcc3101485..301d784b35 100644
--- a/core/src/main/scala/org/apache/spark/storage/BlockId.scala
+++ b/core/src/main/scala/org/apache/spark/storage/BlockId.scala
@@ -17,6 +17,8 @@
package org.apache.spark.storage
+import java.util.UUID
+
/**
* Identifies a particular Block of data, usually associated with a single file.
* A Block can be uniquely identified by its filename, but each type of Block has a different
@@ -68,8 +70,8 @@ private[spark] case class StreamBlockId(streamId: Int, uniqueId: Long) extends B
def name = "input-" + streamId + "-" + uniqueId
}
-/** Block associated with temporary data managed as blocks. */
-private[spark] case class TempBlockId(id: String) extends BlockId {
+/** Id associated with temporary data managed as blocks. Not serializable. */
+private[spark] case class TempBlockId(id: UUID) extends BlockId {
def name = "temp_" + id
}
@@ -85,7 +87,6 @@ private[spark] object BlockId {
val BROADCAST_HELPER = "broadcast_([0-9]+)_([A-Za-z0-9]+)".r
val TASKRESULT = "taskresult_([0-9]+)".r
val STREAM = "input-([0-9]+)-([0-9]+)".r
- val TEMP = "temp_(.*)".r
val TEST = "test_(.*)".r
/** Converts a BlockId "name" String back into a BlockId. */
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 32da458a6f..e25bc90c4f 100644
--- a/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
+++ b/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
@@ -92,9 +92,9 @@ private[spark] class DiskBlockManager(shuffleManager: ShuffleBlockManager, rootD
/** Produces a unique block id and File suitable for intermediate results. */
def createTempBlock(): (TempBlockId, File) = {
- var blockId = new TempBlockId(UUID.randomUUID().toString)
+ var blockId = new TempBlockId(UUID.randomUUID())
while (getFile(blockId).exists()) {
- blockId = new TempBlockId(UUID.randomUUID().toString)
+ blockId = new TempBlockId(UUID.randomUUID())
}
(blockId, getFile(blockId))
}