cloud-fan commented on a change in pull request #28756:
URL: https://github.com/apache/spark/pull/28756#discussion_r438518655
##########
File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
##########
@@ -322,11 +322,15 @@ private[spark] class Executor(
val taskId = taskDescription.taskId
val threadName = s"Executor task launch worker for task $taskId"
val taskName = taskDescription.name
- val mdcProperties = taskDescription.properties.asScala
- .filter(_._1.startsWith("mdc.")).map { item =>
+ val mdcProperties = (taskDescription.properties.asScala ++
+ Seq((Executor.TASK_MDC_KEY, taskName)))
+ .filter(_._1.startsWith(Executor.MDC_KEY)).map { item =>
val key = item._1.substring(4)
+ if (key == Executor.TASK_MDC_KEY && item._2 != taskName) {
+ logWarning(s"Override mdc.taskName is not allowed, ignore
${item._2}")
Review comment:
I think the original `setMDCForTask` method looks OK as long as we set
task mdc key at the end. It also helps avoid duplicated code.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]