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

    https://github.com/apache/spark/pull/126#discussion_r11369285
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/BlockManagerMaster.scala ---
    @@ -125,6 +156,51 @@ class BlockManagerMaster(var driverActor: ActorRef, 
conf: SparkConf) extends Log
         askDriverWithReply[Array[StorageStatus]](GetStorageStatus)
       }
     
    +  /**
    +   * Return the block's status on all block managers, if any. NOTE: This 
is a
    +   * potentially expensive operation and should only be used for testing.
    +   *
    +   * If askSlaves is true, this invokes the master to query each block 
manager for the most
    +   * updated block statuses. This is useful when the master is not 
informed of the given block
    +   * by all block managers.
    +   */
    +  def getBlockStatus(
    +      blockId: BlockId,
    +      askSlaves: Boolean = true): Map[BlockManagerId, BlockStatus] = {
    +    val msg = GetBlockStatus(blockId, askSlaves)
    +    /*
    +     * To avoid potential deadlocks, the use of Futures is necessary, 
because the master actor
    +     * should not block on waiting for a block manager, which can in turn 
be waiting for the
    +     * master actor for a response to a prior message.
    +     */
    +    val response = askDriverWithReply[Map[BlockManagerId, 
Future[Option[BlockStatus]]]](msg)
    +    val (blockManagerIds, futures) = response.unzip
    +    val result = Await.result(Future.sequence(futures), timeout)
    +    if (result == null) {
    +      throw new SparkException("BlockManager returned null for BlockStatus 
query: " + blockId)
    +    }
    +    val blockStatus = result.asInstanceOf[Iterable[Option[BlockStatus]]]
    +    blockManagerIds.zip(blockStatus).flatMap { case (blockManagerId, 
status) =>
    +      status.map { s => (blockManagerId, s) }
    +    }.toMap
    +  }
    +
    +  /**
    +   * Return a list of ids of existing blocks such that the ids match the 
given filter. NOTE: This
    +   * is a potentially expensive operation and should only be used for 
testing.
    +   *
    +   * If askSlaves is true, this invokes the master to query each block 
manager for the most
    +   * updated block statuses. This is useful when the master is not 
informed of the given block
    +   * by all block managers.
    +   */
    +  def getMatchinghBlockIds(
    --- End diff --
    
    Wait, this is still a typo...


---
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