chummyhe89 commented on a change in pull request #24556: [SPARK-27641][CORE]
Fix MetricsSystem to remove unregistered source correctly
URL: https://github.com/apache/spark/pull/24556#discussion_r284227743
##########
File path: core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
##########
@@ -166,9 +172,12 @@ private[spark] class MetricsSystem private (
}
def removeSource(source: Source) {
- sources -= source
Review comment:
```java
def removeSource(source: Source) {
sources -= source
val regName = buildRegistryName(source)
registry.removeMatching((name: String, _: Metric) =>
name.startsWith(regName))
}
```
Even if the `source` is not in `sources`
the original code will execute the code after `sources -= source` which will
remove the metrics of the source.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]