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

    https://github.com/apache/spark/pull/1241#discussion_r14696062
  
    --- Diff: 
core/src/main/scala/org/apache/spark/shuffle/hash/HashShuffleBlockManager.scala 
---
    @@ -156,17 +162,25 @@ class ShuffleBlockManager(blockManager: BlockManager) 
extends Logging {
     
       /**
        * Returns the physical file segment in which the given BlockId is 
located.
    -   * This function should only be called if shuffle file consolidation is 
enabled, as it is
    -   * an error condition if we don't find the expected block.
        */
       def getBlockLocation(id: ShuffleBlockId): FileSegment = {
    -    // Search all file groups associated with this shuffle.
    -    val shuffleState = shuffleStates(id.shuffleId)
    -    for (fileGroup <- shuffleState.allFileGroups) {
    -      val segment = fileGroup.getFileSegmentFor(id.mapId, id.reduceId)
    -      if (segment.isDefined) { return segment.get }
    +    if (consolidateShuffleFiles) {
    +      // Search all file groups associated with this shuffle.
    +      val shuffleState = shuffleStates(id.shuffleId)
    +      for (fileGroup <- shuffleState.allFileGroups) {
    --- End diff --
    
    While you are at it, do you mind rewriting this into a while loop? It gets 
expensive to do "return" within a for closure. 


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