From 710917a50e7e32769e2a5833b4ab9f87d558a4b8 Mon Sep 17 00:00:00 2001 From: Evan Chan Date: Fri, 5 Apr 2013 12:37:56 -0700 Subject: [PATCH] Fix broker partition info logic introduced by hack 8c2369c45e85d1f8ba95e89f23fb7aaf4bc15731 --- .../main/scala/kafka/producer/ZKBrokerPartitionInfo.scala | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/scala/kafka/producer/ZKBrokerPartitionInfo.scala b/core/src/main/scala/kafka/producer/ZKBrokerPartitionInfo.scala index 87cf706695b69..b8d2d308fdb06 100644 --- a/core/src/main/scala/kafka/producer/ZKBrokerPartitionInfo.scala +++ b/core/src/main/scala/kafka/producer/ZKBrokerPartitionInfo.scala @@ -168,10 +168,7 @@ private[producer] class ZKBrokerPartitionInfo(config: ZKConfig, producerCbk: (In val brokerTopicPath = ZkUtils.BrokerTopicsPath + "/" + topic val brokerList = ZkUtils.getChildrenParentMayNotExist(zkClient, brokerTopicPath) - val numPartitions = brokerList.map{bid => - val x = ZkUtils.readData(zkClient, brokerTopicPath + "/" + bid) - if (x == "") 0 else bid.toInt - } + val numPartitions = brokerList.map { bid => ZkUtils.readData(zkClient, brokerTopicPath + "/" + bid).toInt } val brokerPartitions = brokerList.map(bid => bid.toInt).zip(numPartitions) val sortedBrokerPartitions = brokerPartitions.sortWith((id1, id2) => id1._1 < id2._1)