viirya commented on a change in pull request #27280: [SPARK-30571][SQL] fix
splitting shuffle fetch requests
URL: https://github.com/apache/spark/pull/27280#discussion_r368683769
##########
File path:
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -332,37 +332,47 @@ final class ShuffleBlockFetcherIterator(
val iterator = blockInfos.iterator
var curRequestSize = 0L
var curBlocks = new ArrayBuffer[FetchBlockInfo]
+
+ def createFetchRequest(blocks: Seq[FetchBlockInfo]): Unit = {
+ collectedRemoteRequests += FetchRequest(address, blocks)
+ logDebug(s"Creating fetch request of $curRequestSize at $address "
+ + s"with ${blocks.size} blocks")
+ }
+
+ def createFetchRequests(): Unit = {
+ val mergedBlocks = mergeContinuousShuffleBlockIdsIfNeeded(curBlocks)
+ curBlocks = new ArrayBuffer[FetchBlockInfo]
+ if (mergedBlocks.length <= maxBlocksInFlightPerAddress) {
+ createFetchRequest(mergedBlocks)
+ } else {
+ mergedBlocks.grouped(maxBlocksInFlightPerAddress).foreach { blocks =>
+ if (blocks.length == maxBlocksInFlightPerAddress) {
+ createFetchRequest(blocks)
+ } else {
+ // The last group does not exceed `maxBlocksInFlightPerAddress`.
Put it back
+ // to `curBlocks`.
+ curBlocks = blocks
+ numBlocksToFetch -= blocks.size
Review comment:
Good catch!
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]