otterc commented on a change in pull request #32140:
URL: https://github.com/apache/spark/pull/32140#discussion_r648493846



##########
File path: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -347,20 +361,48 @@ final class ShuffleBlockFetcherIterator(
     }
   }
 
-  private[this] def partitionBlocksByFetchMode(): ArrayBuffer[FetchRequest] = {
+  /**
+   * This is called from initialize and also from the fallback which is 
triggered from
+   * [[PushBasedFetchHelper]].
+   */
+  private[this] def partitionBlocksByFetchMode(
+      blocksByAddress: Iterator[(BlockManagerId, Seq[(BlockId, Long, Int)])],
+      localBlocks: scala.collection.mutable.LinkedHashSet[(BlockId, Int)],
+      hostLocalBlocksByExecutor: mutable.LinkedHashMap[BlockManagerId, 
Seq[(BlockId, Long, Int)]],
+      mergedLocalBlocks: mutable.LinkedHashSet[BlockId]): 
ArrayBuffer[FetchRequest] = {
     logDebug(s"maxBytesInFlight: $maxBytesInFlight, targetRemoteRequestSize: "
       + s"$targetRemoteRequestSize, maxBlocksInFlightPerAddress: 
$maxBlocksInFlightPerAddress")
 
-    // Partition to local, host-local and remote blocks. Remote blocks are 
further split into
-    // FetchRequests of size at most maxBytesInFlight in order to limit the 
amount of data in flight
+    // Partition to local, host-local, merged-local, remote (includes 
merged-remote) blocks.
+    // Remote blocks are further split into FetchRequests of size at most 
maxBytesInFlight in order
+    // to limit the amount of data in flight
     val collectedRemoteRequests = new ArrayBuffer[FetchRequest]
+    val hostLocalBlocksCurrentIteration = mutable.LinkedHashSet[(BlockId, 
Int)]()
     var localBlockBytes = 0L
     var hostLocalBlockBytes = 0L
+    var mergedLocalBlockBytes = 0L
     var remoteBlockBytes = 0L
+    val prevNumBlocksToFetch = numBlocksToFetch
 
     val fallback = FallbackStorage.FALLBACK_BLOCK_MANAGER_ID.executorId
     for ((address, blockInfos) <- blocksByAddress) {
-      if (Seq(blockManager.blockManagerId.executorId, 
fallback).contains(address.executorId)) {
+      if (pushBasedFetchHelper.isMergedShuffleBlockAddress(address)) {
+        // These are push-based merged blocks or chunks of these merged blocks.
+        if (address.host == blockManager.blockManagerId.host) {
+          checkBlockSizes(blockInfos)
+          val pushMergedBlockInfos = mergeContinuousShuffleBlockIdsIfNeeded(
+            blockInfos.map(info => FetchBlockInfo(info._1, info._2, info._3)), 
doBatchFetch = false)

Review comment:
       Actually no reason. The method was just returning the original blocks if 
`doBatchFetch = false`, so was calling it. I will change it to not call it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to