You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/11 02:32:31 UTC

[GitHub] [spark] Ngone51 commented on a change in pull request #28756: [SPARK-8981][CORE][FOLLOW-UP] Clean up MDC properties after running a task

Ngone51 commented on a change in pull request #28756:
URL: https://github.com/apache/spark/pull/28756#discussion_r438509140



##########
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:
       Actually, we've already add the task mdc key at the new line 326. We can remove the warning if it's ok to override silently.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org