You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by GitBox <gi...@apache.org> on 2022/12/05 02:26:11 UTC

[GitHub] [incubator-celeborn] zhongqiangczq commented on a diff in pull request #1013: [CELEBORN-71] pushdatahandler supports mappartition write: handshake/regionstart/regionfinish

zhongqiangczq commented on code in PR #1013:
URL: https://github.com/apache/incubator-celeborn/pull/1013#discussion_r1039091651


##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/PushDataHandler.scala:
##########
@@ -526,4 +530,278 @@ class PushDataHandler extends BaseMessageHandler with Logging {
       message.body().release()
     }
   }
+
+  private def handleRpcRequest(client: TransportClient, rpcRequest: RpcRequest): Unit = {
+    val msg = Message.decode(rpcRequest.body().nioByteBuffer())
+    val requestId = rpcRequest.requestId
+    val (mode, shuffleKey, partitionUniqueId, isCheckSplit) = msg match {
+      case p: PushDataHandShake => (p.mode, p.shuffleKey, p.partitionUniqueId, false)
+      case rs: RegionStart => (rs.mode, rs.shuffleKey, rs.partitionUniqueId, true)
+      case rf: RegionFinish => (rf.mode, rf.shuffleKey, rf.partitionUniqueId, false)
+    }
+    handleCore(
+      client,
+      rpcRequest,
+      requestId,
+      () =>
+        handleRpcRequestCore(
+          mode,
+          msg,
+          shuffleKey,
+          partitionUniqueId,
+          requestId,
+          isCheckSplit,
+          new SimpleRpcResponseCallback(
+            msg.`type`(),
+            client,
+            requestId,
+            shuffleKey,
+            partitionUniqueId)))
+
+  }
+
+  private def handleRpcRequestCore(
+      mode: Byte,
+      message: Message,
+      shuffleKey: String,
+      partitionUniqueId: String,
+      requestId: Long,
+      isCheckSplit: Boolean,
+      callback: RpcResponseCallback): Unit = {
+    val isMaster = mode == PartitionLocation.Mode.MASTER
+    val messageType = message.`type`()
+    log.info(s"requestId:$requestId, pushdata rpc:$messageType, mode:$mode, shuffleKey:$shuffleKey, partitionUniqueId:$partitionUniqueId")
+    val (workerSourceMaster, workerSourceSlave) =
+      messageType match {
+        case Type.PUSH_DATA_HAND_SHAKE =>
+          (WorkerSource.MasterPushDataHandshakeTime, WorkerSource.SlavePushDataHandshakeTime)
+        case Type.REGION_START =>
+          (WorkerSource.MasterRegionStartTime, WorkerSource.SlaveRegionStartTime)
+        case Type.REGION_FINISH =>
+          (WorkerSource.MasterRegionFinishTime, WorkerSource.SlaveRegionFinishTime)
+      }
+
+    val location = isMaster match {
+      case true => partitionLocationInfo.getMasterLocation(shuffleKey, partitionUniqueId)
+      case false => partitionLocationInfo.getSlaveLocation(shuffleKey, partitionUniqueId)
+    }
+    workerSource.startTimer(if (isMaster) workerSourceMaster else workerSourceSlave, s"$requestId")

Review Comment:
   yes, checkLocationNull which depends wrappedcallback to send response will process location=null 



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

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org