Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

Status

Current state["Under Discussion"]

Discussion thread: TBD here

JIRA:

Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyKAFKA-5319
 

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

    Get information of every TP ( topic and partition ) from zookeeper,and then get the state of "PreferredReplicaLeader" on every alive brokers.Calculate the avg of amount of"PreferredReplicaLeader" on every brokers.We think a leader balance state is the amount of preferred leaders of each brokers are close to the avg. We call brokers which need to move leader position "SourceBroker",and brokers need to get we call them "TargetBroker".During moving ,we should make sure the amount of leaders on SourceBroker is greater than the avg,the  amount of leaders on TargetBroker is less than the avg,and the TargetBroker should has the same TP of the leader SourceBroker want to move. e.g.

Image Removed

As above shows.We get a inverted list  . Broker1 is a SourceBroker,Broker3 is a TargetBroker.We can't move the preferred leader of TP1 to Broker3,because there is not a replica of TP1 on Broker3 ( Do not "has the same TP of the leader SourceBroker want to move" ).

Finally use ReassignPartitionsCommand to assign partition with the balance assignment we get above.

3.replica-balance

    Replica balance is similar to leader balance.The different is during moving the replica we should make sure there is not a replica which is belong to the same TP with the replica SourceBroker want to move  on TargetBroker.   We also provide a "threshold" option .Within the "threshold" option we think it is balanced.Because replica balance costs more than leader balance.It touches on data migration.The default is 10 which means 10% of the avg.

 

e.g.

Image Removed

As above shows. Broker1 is a SourceBroker,and Broker4 is a TargetBroker.We can't move the replica of TP4 to Broker3,because there a replica in the AR of TP4 on Broker4.

4.cluster-balance

     Cluster-balance do replica balance first,and then execute leader balance ,finally use ReassignPartitionsCommand to assign partition with the balance assignment we get above.

 

Click here to view the code.

Compatibility, Deprecation, and Migration Plan

...