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



-- 
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: [email protected]

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