Calvin Liu created KAFKA-19212:
----------------------------------

             Summary: Fix ElectionWasClean method bug when partition 
reassignment completes
                 Key: KAFKA-19212
                 URL: https://issues.apache.org/jira/browse/KAFKA-19212
             Project: Kafka
          Issue Type: Bug
            Reporter: Calvin Liu
            Assignee: Calvin Liu
             Fix For: 4.1.0


The current ElectionWasClean checks if the new leader is in the previous ISR. 
However, there is a corner case in the partition reassignment.

The partition reassignment can change the partition replicas. If the new 
preferred leader (the first one in the new replicas) is the last one to join 
ISR, this preferred leader will be elected in the same partition change.

For example:

In the previous state, the partition is

Leader: 0, Replicas (2,1,0), ISR (1,0), Adding(2), removing(0).

Then replica 2 joins the ISR. The new partition would be like:

Leader: 2, Replicas (2,1), ISR(1,2).

The new leader 2 is not in the previous ISR (1,0) but it is still a clean 
election.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to