kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: KAFKA-2973; Fix leak of child sensors on remove
Date Wed, 09 Dec 2015 17:52:30 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.9.0 78192b8be -> f90670621


KAFKA-2973; Fix leak of child sensors on remove

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Gwen Shapira, Guozhang Wang

Closes #650 from ijuma/kafka-2973-fix-leak-child-sensors-on-remove

(cherry picked from commit 977ebbe9bafb6c1a6e1be69620f745712118fe80)
Signed-off-by: Gwen Shapira <cshapi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/f9067062
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/f9067062
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/f9067062

Branch: refs/heads/0.9.0
Commit: f90670621c8fab3a60ee62ec428fcd0452178f1c
Parents: 78192b8
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Wed Dec 9 09:52:17 2015 -0800
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Wed Dec 9 09:52:26 2015 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/kafka/common/metrics/Metrics.java    | 2 +-
 .../test/java/org/apache/kafka/common/metrics/MetricsTest.java    | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/f9067062/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java b/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
index fdb7dac..eb46e2c 100644
--- a/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
+++ b/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java
@@ -190,7 +190,7 @@ public class Metrics implements Closeable {
             this.sensors.put(name, s);
             if (parents != null) {
                 for (Sensor parent : parents) {
-                    List<Sensor> children = childrenSensors.get(parent.name());
+                    List<Sensor> children = childrenSensors.get(parent);
                     if (children == null) {
                         children = new ArrayList<>();
                         childrenSensors.put(parent, children);

http://git-wip-us.apache.org/repos/asf/kafka/blob/f9067062/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java b/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java
index d465c98..5bf3e87 100644
--- a/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java
@@ -155,6 +155,9 @@ public class MetricsTest {
         assertEquals(1.0, c2, EPS);
         assertEquals(1.0 + c1, p2, EPS);
         assertEquals(1.0 + c1 + c2, p1, EPS);
+        assertEquals(Arrays.asList(child1, child2), metrics.childrenSensors().get(parent1));
+        assertEquals(Arrays.asList(child1), metrics.childrenSensors().get(parent2));
+        assertNull(metrics.childrenSensors().get(grandchild));
     }
 
     @Test(expected = IllegalArgumentException.class)


Mime
View raw message