Commit 91cd06b
[SPARK-8981][CORE][FOLLOW-UP] Clean up MDC properties after running a task
### What changes were proposed in this pull request?
This PR is a followup of #26624. This PR cleans up MDC properties if the original value is empty.
Besides, this PR adds a warning and ignore the value when the user tries to override the value of `taskName`.
### Why are the changes needed?
Before this PR, running the following jobs:
```
sc.setLocalProperty("mdc.my", "ABC")
sc.parallelize(1 to 100).count()
sc.setLocalProperty("mdc.my", null)
sc.parallelize(1 to 100).count()
```
there's still MDC value "ABC" in the log of the second count job even if we've unset the value.
### Does this PR introduce _any_ user-facing change?
Yes, user will 1) no longer see the MDC values after unsetting the value; 2) see a warning if he/she tries to override the value of `taskName`.
### How was this patch tested?
Tested Manaually.
Closes #28756 from Ngone51/followup-8981.
Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>1 parent 912d45d commit 91cd06b
1 file changed
Lines changed: 4 additions & 8 deletions
Lines changed: 4 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
405 | 404 | | |
406 | | - | |
407 | 405 | | |
408 | 406 | | |
409 | 407 | | |
| |||
703 | 701 | | |
704 | 702 | | |
705 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
706 | 708 | | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | 709 | | |
712 | 710 | | |
713 | 711 | | |
| |||
750 | 748 | | |
751 | 749 | | |
752 | 750 | | |
753 | | - | |
754 | 751 | | |
755 | | - | |
756 | 752 | | |
757 | 753 | | |
758 | 754 | | |
| |||
0 commit comments