mridulm commented on a change in pull request #33063:
URL: https://github.com/apache/spark/pull/33063#discussion_r658558309
##########
File path:
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -433,28 +436,25 @@ final class ShuffleBlockFetcherIterator(
address: BlockManagerId,
blockInfos: Seq[(BlockId, Long, Int)],
collectedRemoteRequests: ArrayBuffer[FetchRequest]): Unit = {
- val iterator = blockInfos.iterator
var curRequestSize = 0L
- var curBlocks = Seq.empty[FetchBlockInfo]
+ val curBlocks = new ArrayBuffer[FetchBlockInfo]()
- while (iterator.hasNext) {
- val (blockId, size, mapIndex) = iterator.next()
+ for ((blockId, size, mapIndex) <- blockInfos) {
assertPositiveBlockSize(blockId, size)
- curBlocks = curBlocks ++ Seq(FetchBlockInfo(blockId, size, mapIndex))
+ curBlocks += FetchBlockInfo(blockId, size, mapIndex)
curRequestSize += size
// For batch fetch, the actual block in flight should count for merged
block.
val mayExceedsMaxBlocks = !doBatchFetch && curBlocks.size >=
maxBlocksInFlightPerAddress
if (curRequestSize >= targetRemoteRequestSize || mayExceedsMaxBlocks) {
- curBlocks = createFetchRequests(curBlocks, address, isLast = false,
- collectedRemoteRequests)
+ val rest = createFetchRequests(curBlocks, address, isLast = false,
collectedRemoteRequests)
+ curBlocks.clear()
+ curBlocks ++= rest
Review comment:
The PR is already doing this for
`mergeContinuousShuffleBlockIdsIfNeeded` ? This is why it is important to
preserve semantics.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]