-
Task
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
False
-
False
-
Undefined
-
Currently, when unclean leadership elections happen, the new partition leader is simply chosen as the first online replica in the replica list. This is regardless of weather that first replica is significantly behind any of the other replicas.
Resorting to unclean elections means that conditions are already not ideal, however it would be useful in these situations to not make the issue worse by choosing a leader that could potentially be far behind the other replicas. In the extreme case a replica that has just started/corrupted its log could become leader, leading to total data loss for the partition.
We should add functionality to the AdminClient and the bin/kafak-leader-election.sh that allows a user to perform and unclean leadership election but selecting the most up-to-date replica from those online.