Skip to content

Commit

Permalink
use randomUUID to generate sparkapp directory name on tachyon;minor c…
Browse files Browse the repository at this point in the history
…ode style fix
  • Loading branch information
RongGu committed Mar 27, 2014
1 parent 939e467 commit fd84156
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
import org.apache.spark.storage.TachyonFileSegment;

public interface TachyonFilePathResolver {
/** Get the file segment in which the given block resides. */
/** Get the file segment in which the given block resides. This is not a user-facing API*/
TachyonFileSegment getBlockLocation(BlockId blockId);
}
4 changes: 2 additions & 2 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import java.io._
import java.net.URI
import java.util.{Properties, UUID}
import java.util.concurrent.atomic.AtomicInteger
import java.util.UUID.randomUUID
import scala.collection.{Map, Set}
import scala.collection.generic.Growable
import scala.collection.mutable.{ArrayBuffer, HashMap}
Expand All @@ -42,7 +43,6 @@ import org.apache.spark.scheduler.local.LocalBackend
import org.apache.spark.storage.{BlockManagerSource, RDDInfo, StorageStatus, StorageUtils}
import org.apache.spark.ui.SparkUI
import org.apache.spark.util.{ClosureCleaner, MetadataCleaner, MetadataCleanerType, TimeStampedHashMap, Utils}
import java.util.Random

/**
* Main entry point for Spark functionality. A SparkContext represents the connection to a Spark
Expand Down Expand Up @@ -128,7 +128,7 @@ class SparkContext(

// Generate the random name for a temp folder in Tachyon
// Add a timestamp as the suffix here to make it more safe
val tachyonFolderName = new Random().nextInt() + "_" + System.currentTimeMillis()
val tachyonFolderName = "spark-" + randomUUID.toString()
conf.set("spark.tachyonstore.foldername", tachyonFolderName)

val isLocal = (master == "local" || master.startsWith("local["))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private[spark] class BlockManager(
private[storage] val memoryStore: BlockStore = new MemoryStore(this, maxMemory)
private[storage] val diskStore = new DiskStore(this, diskBlockManager)
var tachyonInitialized = false
private[storage] lazy val tachyonStore : TachyonStore = {
private[storage] lazy val tachyonStore: TachyonStore = {
val storeDir = conf.get("spark.tachyonstore.dir", System.getProperty("java.io.tmpdir"))
val appFolderName = conf.get("spark.tachyonstore.foldername")
val tachyonStorePath = s"${storeDir}/${appFolderName}/${this.executorId}"
Expand Down Expand Up @@ -1000,7 +1000,7 @@ private[spark] class BlockManager(
blockInfo.clear()
memoryStore.clear()
diskStore.clear()
if(tachyonInitialized) {
if (tachyonInitialized) {
tachyonStore.clear()
}
metadataCleaner.cancel()
Expand Down

0 comments on commit fd84156

Please sign in to comment.