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 2019/05/09 03:39:57 UTC

[GitHub] [spark] chummyhe89 commented on a change in pull request #24556: [SPARK-27641][CORE] Fix MetricsSystem to remove unregistered source correctly

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_r282328568
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
 ##########
 @@ -166,9 +166,11 @@ private[spark] class MetricsSystem private (
   }
 
   def removeSource(source: Source) {
-    sources -= source
-    val regName = buildRegistryName(source)
-    registry.removeMatching((name: String, _: Metric) => name.startsWith(regName))
+    if (sources.contains(source)) {
+      sources -= source
 
 Review comment:
   I add existing check because original code removes the metrics no matter whether the source was registered or not. i will use index to avoid the twice navigating.thanks for your advice.

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


With regards,
Apache Git Services

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