ruanwenjun commented on code in PR #17605:
URL: 
https://github.com/apache/dolphinscheduler/pull/17605#discussion_r2465015509


##########
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/rpc/PhysicalTaskExecutorOperatorImpl.java:
##########
@@ -46,10 +47,20 @@ public class PhysicalTaskExecutorOperatorImpl implements 
IPhysicalTaskExecutorOp
 
     @Override
     public TaskExecutorDispatchResponse dispatchTask(final 
TaskExecutorDispatchRequest taskExecutorDispatchRequest) {
-        log.info("Receive TaskExecutorDispatchResponse: {}", 
taskExecutorDispatchRequest);
         final TaskExecutionContext taskExecutionContext = 
taskExecutorDispatchRequest.getTaskExecutionContext();
-        try {
+        final int taskInstanceId = taskExecutionContext.getTaskInstanceId();
+        final int workflowInstanceId = 
taskExecutionContext.getWorkflowInstanceId();
+
+        try (
+                TaskExecutorMDCUtils.MDCAutoClosable _ignore1 =
+                        TaskExecutorMDCUtils.logWithMDC(taskInstanceId, 
workflowInstanceId)) {
+
+            log.info("Receive TaskExecutorDispatchResponse: {}", 
taskExecutorDispatchRequest);
             
physicalTaskEngineDelegator.dispatchLogicTask(taskExecutionContext);
+
+            // Reset MDC, because dispatchLogicTask will clear MDC internally
+            TaskExecutorMDCUtils.logWithMDC(taskInstanceId, 
workflowInstanceId);

Review Comment:
   If so, you should remove MDC in `physicalTaskEngineDelegator`



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

Reply via email to