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

    https://github.com/apache/spark/pull/1609#discussion_r15541257
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockManager.scala ---
    @@ -236,31 +241,61 @@ object ShuffleBlockManager {
           new PrimitiveVector[Long]()
         }
     
    -    def numBlocks = mapIdToIndex.size
    +    /*
    +     * This is required for shuffle consolidation to work. In particular 
when updates to file are
    +     * happening while parallel requests to fetch block happens.
    +     */
    +    private val blockLengthsByReducer = 
Array.fill[PrimitiveVector[Long]](files.length) {
    +      new PrimitiveVector[Long]()
    +    }
    +
    +    private var numBlocks = 0
    --- End diff --
    
    The reason for change to var from def is perhaps subtle.
    Consider the case of :
    
    add for mapIdToIndex with mapId 0
    add for mapIdToIndex with mapId 1
    add for mapIdToIndex with mapId 0 (on re-execution)
    add for mapIdToIndex with mapId 1 (on re-execution)
    
    Now both 0 and 1 will end up with the same index assigned (since it was 
based on mapIdToIndex.size).


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to