Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/158#discussion_r11052669
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/TachyonBlockManager.scala ---
    @@ -0,0 +1,164 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.storage
    +
    +import java.text.SimpleDateFormat
    +import java.util.{Date, Random}
    +
    +import tachyon.client.TachyonFS
    +import tachyon.client.TachyonFile
    +
    +import org.apache.spark.Logging
    +import org.apache.spark.executor.ExecutorExitCode
    +import org.apache.spark.network.netty.{TachyonFilePathResolver, 
ShuffleSender}
    +import org.apache.spark.util.Utils
    +
    +
    +/**
    + * Creates and maintains the logical mapping between logical blocks and 
tachyon fs locations. By
    + * default, one block is mapped to one file with a name given by its 
BlockId.
    + *
    + * @param rootDirs The directories to use for storing block files. Data 
will be hashed among these.
    + */
    +private[spark] class TachyonBlockManager(
    +    shuffleManager: ShuffleBlockManager, 
    +    rootDirs: String, 
    +    val master: String)
    +  extends TachyonFilePathResolver with Logging {
    +
    +  val client = if (master != null && master != "") TachyonFS.get(master) 
else null
    +
    +  if (client == null) {
    +    logError("Failed to connect to the Tachyon as the master address is 
not configured")
    +    System.exit(ExecutorExitCode.TACHYON_STORE_FAILED_TO_INITIALIZE)
    +  }
    +
    +  private val MAX_DIR_CREATION_ATTEMPTS = 10
    +  private val subDirsPerTachyonDir = 
    +    shuffleManager.conf.get("spark.tachyonStore.subDirectories", 
"64").toInt
    +
    +  // Create one Tachyon directory for each path mentioned in 
spark.tachyonStore.folderName.dir; 
    +  // then, inside this directory, create multiple subdirectories that we 
will hash files into, 
    +  // in order to avoid having really large inodes at the top level in 
Tachyon.
    +  private val tachyonDirs: Array[TachyonFile] = createTachyonDirs()
    +  private val subDirs = Array.fill(tachyonDirs.length)(new 
Array[TachyonFile](subDirsPerTachyonDir))
    +
    +  addShutdownHook()
    +
    +  /**
    +   * Returns the physical tachyon file segment in which the given BlockId 
is located.
    +   * If the BlockId has been mapped to a specific FileSegment, that will 
be returned.
    +   * Otherwise, we assume the Block is mapped to a whole file identified 
by the BlockId directly.
    +   */
    +  def getBlockLocation(blockId: BlockId): TachyonFileSegment = {
    --- End diff --
    
    Yeah I agree, this seems like it was copied from the disk store, which does 
fancy stuff with consolidating files. But we won't put shuffle blocks in 
Tachyon presumably.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to