Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4857#discussion_r25642017
  
    --- Diff: 
core/src/main/scala/org/apache/spark/network/netty/NettyBlockTransferService.scala
 ---
    @@ -106,40 +109,54 @@ class NettyBlockTransferService(conf: SparkConf, 
securityManager: SecurityManage
           blockId: BlockId,
           blockData: ManagedBuffer,
           level: StorageLevel): Future[Unit] = {
    -    val result = Promise[Unit]()
         val client = clientFactory.createClient(hostname, port)
     
         // StorageLevel is serialized as bytes using our JavaSerializer. 
Everything else is encoded
         // using our binary protocol.
         val levelBytes = serializer.newInstance().serialize(level).array()
     
    -    // Convert or copy nio buffer into array in order to serialize it.
    -    val nioBuffer = blockData.nioByteBuffer()
    -    val array = if (nioBuffer.hasArray) {
    -      nioBuffer.array()
    -    } else {
    -      val data = new Array[Byte](nioBuffer.remaining())
    -      nioBuffer.get(data)
    -      data
    -    }
    -
    -    client.sendRpc(new UploadBlock(appId, execId, blockId.toString, 
levelBytes, array).toByteArray,
    -      new RpcResponseCallback {
    -        override def onSuccess(response: Array[Byte]): Unit = {
    -          logTrace(s"Successfully uploaded block $blockId")
    -          result.success()
    -        }
    -        override def onFailure(e: Throwable): Unit = {
    -          logError(s"Error while uploading block $blockId", e)
    -          result.failure(e)
    +    val largeByteBuffer = blockData.nioByteBuffer()
    +    val bufferParts = largeByteBuffer.nioBuffers().asScala
    +    val chunkOffsets: Seq[Long] = bufferParts.scanLeft(0l){case(offset, 
buf) => offset + buf.limit()}
    +
    +    import scala.concurrent.ExecutionContext.Implicits.global
    +    bufferParts.zipWithIndex.foldLeft(Future.successful(())){case 
(prevFuture,(buf,idx)) =>
    --- End diff --
    
    this is the sending side for replication of blocks.  pretty simple on this 
end -- just break it up into msgs < 2gb.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to