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

    https://github.com/apache/spark/pull/126#discussion_r11357428
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/BlockManagerSlaveActor.scala ---
    @@ -26,14 +29,60 @@ import org.apache.spark.storage.BlockManagerMessages._
      * this is used to remove blocks from the slave's BlockManager.
      */
     private[storage]
    -class BlockManagerSlaveActor(blockManager: BlockManager) extends Actor {
    -  override def receive = {
    +class BlockManagerSlaveActor(
    +    blockManager: BlockManager,
    +    mapOutputTracker: MapOutputTracker)
    +  extends Actor with Logging {
    +
    +  import context.dispatcher
     
    +  // Operations that involve removing blocks may be slow and should be 
done asynchronously
    +  override def receive = {
         case RemoveBlock(blockId) =>
    -      blockManager.removeBlock(blockId)
    +      doAsync[Boolean]("removing block", sender) {
    +        blockManager.removeBlock(blockId)
    +        true
    +      }
     
         case RemoveRdd(rddId) =>
    -      val numBlocksRemoved = blockManager.removeRdd(rddId)
    -      sender ! numBlocksRemoved
    +      doAsync[Int]("removing RDD", sender) {
    +        blockManager.removeRdd(rddId)
    +      }
    +
    +    case RemoveShuffle(shuffleId) =>
    +      doAsync[Boolean]("removing shuffle", sender) {
    +        if (mapOutputTracker != null) {
    +          mapOutputTracker.unregisterShuffle(shuffleId)
    +        }
    +        blockManager.shuffleBlockManager.removeShuffle(shuffleId)
    +      }
    +
    +    case RemoveBroadcast(broadcastId, tellMaster) =>
    +      doAsync[Int]("removing RDD", sender) {
    +        blockManager.removeBroadcast(broadcastId, tellMaster)
    +      }
    +
    +    case GetBlockStatus(blockId, _) =>
    +      sender ! blockManager.getStatus(blockId)
    +
    +    case GetMatchingBlockIds(filter, _) =>
    +      sender ! blockManager.getMatchingBlockIds(filter)
    +  }
    +
    +  private def doAsync[T](actionMessage: String, responseActor: 
ActorRef)(body: => T) {
    +    val future = Future {
    +      logDebug(actionMessage)
    +      val response = body
    +      response
    --- End diff --
    
    Why not just rename `body` to `response` in the first place?


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