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

    https://github.com/apache/spark/pull/14412#discussion_r98603866
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala 
---
    @@ -1152,20 +1185,25 @@ private[spark] class BlockManager(
     
         val startTime = System.nanoTime
     
    -    var peersReplicatedTo = mutable.HashSet.empty[BlockManagerId]
    +    var peersReplicatedTo = mutable.HashSet.empty ++ existingReplicas
         var peersFailedToReplicateTo = mutable.HashSet.empty[BlockManagerId]
         var numFailures = 0
     
    +    val initialPeers = {
    +      val peers = getPeers(false)
    +      if(existingReplicas.isEmpty) peers else 
peers.filter(!existingReplicas.contains(_))
    +    }
    +
         var peersForReplication = blockReplicationPolicy.prioritize(
           blockManagerId,
    -      getPeers(false),
    -      mutable.HashSet.empty,
    +      initialPeers,
    +      peersReplicatedTo,
           blockId,
           numPeersToReplicateTo)
     
         while(numFailures <= maxReplicationFailures &&
    -        !peersForReplication.isEmpty &&
    -        peersReplicatedTo.size != numPeersToReplicateTo) {
    +      !peersForReplication.isEmpty &&
    +      peersReplicatedTo.size < numPeersToReplicateTo) {
    --- End diff --
    
    While I think it's still valid to replace the inequality with a 
strictly-less-than check, but just out of curiosity, can the number of 
`peersReplicatedTo` ever exceed `numPeersToReplicateTo`?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to