[ 
https://issues.apache.org/jira/browse/KAFKA-5329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16026532#comment-16026532
 ] 

Jiangjie Qin commented on KAFKA-5329:
-------------------------------------

[~ijuma] The ControllerContext is fine. This ticket is not about controller 
context, but the metadata cache in the brokers, which will be returned to the 
user in the TopicMetadataResponse. 

The issue is following. If user wants to assign one of the broker as the leader 
of a partition, they will first have to ensure that broker is the first replica 
in the replica array, then do a preferred leader election for that partition. 
In this case, user can either look into zkNode, or get the replica list from 
the TopicMetadataResponse from brokers. If users are designating a lot of 
leaders, using TopicMetadataResponse would be much more efficient. So it is 
useful to make sure the replica list in the TopicMetadataResponse is correct. 
Also given the metadata returned from broker represents replicas in an array, 
it is weird to not making it align with the actual replica order.

> Replica list in the metadata cache on the broker may have different order 
> from zookeeper
> ----------------------------------------------------------------------------------------
>
>                 Key: KAFKA-5329
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5329
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.10.2.1
>            Reporter: Jiangjie Qin
>              Labels: newbie
>             Fix For: 0.11.0.1
>
>
> It looks that in {{PartitionStateInfo}} we are storing the replicas in a set 
> instead of a Seq. This causes the replica order to be lost. In most case it 
> is fine, but in the context of preferred leader election, the replica order 
> determines which replica is the preferred leader of a partition. It would be 
> useful to make the order always be consistent with the order in zookeeper. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to