[ https://issues.apache.org/jira/browse/KAFKA-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13669340#comment-13669340 ]
Jun Rao commented on KAFKA-923: ------------------------------- Thanks for the patch. Looks good. Some minor comments: 1. ReplicaStateMachine.getAllReplicasOnBroker(): We have the following statement: Set.empty[PartitionAndReplica] ++ brokerIds.map { ... }.flatten Is it simpler to write it as brokerIds.map { ... }.flatten.toSet? 2. In KafkaController: There is another place that we could optimize. In updateLeaderAndIsrCache(), we make the following call val leaderAndIsrInfo = ZkUtils.getPartitionLeaderAndIsrForTopics(zkClient, controllerContext.allTopics.toSeq) which will call getPartitionsForTopics and read all partition assignments from ZK again. Since at this point, we already know all partitions, we could just pass in the partition set to getPartitionLeaderAndIsrForTopics() to avoid reading each topic again. > Improve controller failover latency > ----------------------------------- > > Key: KAFKA-923 > URL: https://issues.apache.org/jira/browse/KAFKA-923 > Project: Kafka > Issue Type: Improvement > Components: controller > Affects Versions: 0.8 > Reporter: Neha Narkhede > Assignee: Neha Narkhede > Priority: Critical > Labels: kafka-0.8 > Attachments: kafka-923-v1.patch > > > During controller failover, we do the following things - > 1. Increment controller epoch > 2. Initialize controller context > 3. Initialize replica state machine > 4. Initialize partition state machine > During step 2 above, we read the information of all topics and partitions, > the replica assignments and leadership information. During step 3 and 4, we > re-read some of this information from zookeeper. Since the zookeeper reads > are proportional to the number of topics and the reads are serial, it is > important to optimize this. The zookeeper reads in steps 3 and 4 are not > required. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira