Ngone51 commented on a change in pull request #32287:
URL: https://github.com/apache/spark/pull/32287#discussion_r625157041



##########
File path: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -317,6 +377,14 @@ final class ShuffleBlockFetcherIterator(
         hostLocalBlockBytes += mergedBlockInfos.map(_.size).sum
       } else {
         remoteBlockBytes += blockInfos.map(_._2).sum
+        val inMemoryBlocks = blockInfos.filter(_._2 <= 
maxReqSizeShuffleToMem).map(_._2)
+        val maxInMemoryBlock = if (inMemoryBlocks.isEmpty) 0L else 
inMemoryBlocks.max
+        if (PlatformDependent.directBufferPreferred() &&
+            PlatformDependent.maxDirectMemory() < maxInMemoryBlock) {
+          throw new SparkException(
+            s"Netty memory (${PlatformDependent.maxDirectMemory()} bytes) is 
too small to " +
+              s"serve the max in-memory shuffle block ($maxInMemoryBlock 
bytes).")
+        }

Review comment:
       I don't think so. Here, we are not checking the case of 
`PlatformDependent.maxDirectMemory() < maxReqSizeShuffleToMem`, but the case of 
`PlatformDependent.maxDirectMemory() < maxInMemoryBlock` (where 
`maxInMemoryBlock` could be less than `maxReqSizeShuffleToMem`). For example, 
we assume the block fetching could be successful if maxDirectMemory=500M,  
maxReqSizeShuffleToMem=600M,  maxInMemoryBlock=400M.




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

Reply via email to