TempBlockId takes UUID and is explicitly non-serializable

Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/88319232
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/88319232
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/88319232

Branch: refs/heads/master
Commit: 8831923219faf1599957056dd5f406a22d1f1128
Parents: 92c304f
Author: Aaron Davidson <aa...@databricks.com>
Authored: Thu Jan 2 13:52:35 2014 -0800
Committer: Aaron Davidson <aa...@databricks.com>
Committed: Thu Jan 2 13:52:35 2014 -0800

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/storage/BlockId.scala    | 7 ++++---
 .../scala/org/apache/spark/storage/DiskBlockManager.scala     | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/88319232/core/src/main/scala/org/apache/spark/storage/BlockId.scala
----------------------------------------------------------------------
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 bcc3101..301d784 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. */

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/88319232/core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala
----------------------------------------------------------------------
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 32da458..e25bc90 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))
   }

Reply via email to