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

    https://github.com/apache/spark/pull/11241#discussion_r55605775
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala 
---
    @@ -570,28 +577,49 @@ private[spark] class BlockManager(
         preferredLocs ++ otherLocs
       }
     
    -  private def doGetRemote(blockId: BlockId, asBlockResult: Boolean): 
Option[Any] = {
    +  /**
    +   * VisibleForTesting
    +   */
    +  private[spark] def doGetRemote(blockId: BlockId, blockTransferService: 
BlockTransferService,
    +                                 asBlockResult: Boolean): Option[Any] = {
         require(blockId != null, "BlockId is null")
    +    var runningFailureCount = 0
    +    var totalFailureCount = 0
         val locations = getLocations(blockId)
    -    var numFetchFailures = 0
    -    for (loc <- locations) {
    +    val maxFetchFailures = locations.size
    +    var locationIterator = locations.iterator
    +    while (locationIterator.hasNext) {
    +      val loc = locationIterator.next()
           logDebug(s"Getting remote block $blockId from $loc")
           val data = try {
             blockTransferService.fetchBlockSync(
               loc.host, loc.port, loc.executorId, 
blockId.toString).nioByteBuffer()
           } catch {
             case NonFatal(e) =>
    -          numFetchFailures += 1
    -          if (numFetchFailures == locations.size) {
    +          runningFailureCount += 1
    +          totalFailureCount += 1
    +
    +          if (totalFailureCount >= maxFetchFailures) {
                 // An exception is thrown while fetching this block from all 
locations
    --- End diff --
    
    If I understand this correctly, I think this comments needs updating as 
well.  You are no longer necessarily trying _all_ locations -- you're trying as 
many locations as you knew about initially, but (a) the number of locations 
might even be larger and (b) you might end up retrying the same locations after 
a refresh.  Maybe something like:
    
    Give up trying anymore locations.  Either we've tried all of the original 
locations, or we've refreshed the list of locations from the master, and have 
still hit failures after trying locations from the refreshed list.


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