kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nehanarkh...@apache.org
Subject git commit: KAFKA-1068 OfflinePartitionCount metrics may be incorrect after the controller failover; reviewed by Neha Narkhede and Guozhang Wang
Date Tue, 01 Oct 2013 20:23:02 GMT
Updated Branches:
  refs/heads/0.8 56ada9576 -> dcbf0bf0b


KAFKA-1068 OfflinePartitionCount metrics may be incorrect after the controller failover; reviewed
by Neha Narkhede and Guozhang Wang


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

Branch: refs/heads/0.8
Commit: dcbf0bf0b7e949e0f2652d6f3bd967349813bf6f
Parents: 56ada95
Author: Neha Narkhede <neha.narkhede@gmail.com>
Authored: Tue Oct 1 13:22:46 2013 -0700
Committer: Neha Narkhede <neha.narkhede@gmail.com>
Committed: Tue Oct 1 13:22:46 2013 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/controller/KafkaController.scala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/dcbf0bf0/core/src/main/scala/kafka/controller/KafkaController.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/controller/KafkaController.scala b/core/src/main/scala/kafka/controller/KafkaController.scala
index aef41ad..88d130f 100644
--- a/core/src/main/scala/kafka/controller/KafkaController.scala
+++ b/core/src/main/scala/kafka/controller/KafkaController.scala
@@ -129,7 +129,10 @@ class KafkaController(val config : KafkaConfig, zkClient: ZkClient) extends
Logg
     new Gauge[Int] {
       def value(): Int = {
         controllerContext.controllerLock synchronized {
-          controllerContext.partitionLeadershipInfo.count(p => !controllerContext.liveBrokerIds.contains(p._2.leaderAndIsr.leader))
+          if (!isActive())
+            0
+          else
+            controllerContext.partitionLeadershipInfo.count(p => !controllerContext.liveBrokerIds.contains(p._2.leaderAndIsr.leader))
         }
       }
     }


Mime
View raw message