squito commented on a change in pull request #25299: [SPARK-27651][Core] Avoid
the network when shuffle blocks are fetched from the same host
URL: https://github.com/apache/spark/pull/25299#discussion_r309758151
##########
File path:
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -334,10 +339,27 @@ final class ShuffleBlockFetcherIterator(
val totalBytes = localBlockBytes + remoteBlockBytes
logInfo(s"Getting $numBlocksToFetch (${Utils.bytesToString(totalBytes)})
non-empty blocks " +
s"including ${localBlocks.size}
(${Utils.bytesToString(localBlockBytes)}) local blocks and " +
- s"${remoteBlocks.size} (${Utils.bytesToString(remoteBlockBytes)}) remote
blocks")
+ s"${hostLocalBlocks.size} (${Utils.bytesToString(hostLocalBlockBytes)})
host-local blocks " +
+ s"and $numRemoteBlocks (${Utils.bytesToString(remoteBlockBytes)}) remote
blocks")
remoteRequests
}
+
+ private def assertPositiveBlockSize(blockId: BlockId, blockSize: Long): Unit
= {
+ if (blockSize < 0) {
+ throw BlockException(blockId, "Negative block size " + size)
+ } else if (blockSize == 0) {
+ throw BlockException(blockId, "Zero-sized blocks should be excluded.")
+ }
+ }
+
+ private def checkBlockSizes(blockInfos: Seq[(BlockId, Long)]): Unit = {
+ blockInfos.find(_._2 <= 0) match {
+ case Some((blockId, size)) => assertPositiveBlockSize(blockId, size)
+ case None => // do nothing.
Review comment:
is this the same as
```scala
blockInfos.foreach { case (blockId, size) => assertPositiveSize(blockId,
size) }
```
that seems more straightforward to me.
----------------------------------------------------------------
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]