[ 
https://issues.apache.org/jira/browse/MAPREDUCE-6706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18073131#comment-18073131
 ] 

ASF GitHub Bot commented on MAPREDUCE-6706:
-------------------------------------------

pan3793 commented on code in PR #8422:
URL: https://github.com/apache/hadoop/pull/8422#discussion_r3072379145


##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskStatus.java:
##########
@@ -523,5 +523,32 @@ static TaskStatus createTaskStatus(boolean isMap) {
     return (isMap) ? new MapTaskStatus() : new ReduceTaskStatus();
   }
 
+  /**
+   * Write a TaskStatus to a DataOutput, prefixed by an isMap discriminator 
byte.
+   * Used by the Protobuf-based RPC layer to serialize TaskStatus values.
+   * @param out output stream
+   * @param status status to write (must not be null)
+   * @throws IOException on I/O error
+   */
+  public static void writeTaskStatusForPB(DataOutput out, TaskStatus status)
+      throws IOException {
+    out.writeBoolean(status.getIsMap());

Review Comment:
   this looks a little bit hacky - in the current codebase, it is either 
`MapTaskStatus` or `ReduceTaskStatus`, a bool flag is sufficient to distinguish 
them, but this also stops the evolution possibility.
   
   if I'm not wrong, in `WritableRpcEngine`, it uses `ObjectWritable` to 
serialize the `Writable` instance, which carries the class name in the 
metadata, so no issues if we introduce a new `TaskStatus` in the future.
   
   maybe we need another PB data struct instead of a bool flag, though the 
evolution of the MR framework may not happen ...





> Update TaskUmbilicalProtocol to use ProtobufRPCEngine
> -----------------------------------------------------
>
>                 Key: MAPREDUCE-6706
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6706
>             Project: Hadoop Map/Reduce
>          Issue Type: Improvement
>            Reporter: Arun Suresh
>            Assignee: Steve Loughran
>            Priority: Major
>              Labels: pull-request-available
>
> Currently, {{TaskUmbilicalProtocol}} still uses {{WritableRPCEngine}}, which 
> should be moved to {{ProtocolRPCEngine}} so that the former can be deprecated 
> as tracked by HADOOP-12579



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to