Stanislav Kozlovski created KAFKA-9866: ------------------------------------------
Summary: Do not attempt to elect preferred leader replicas which are outside ISR Key: KAFKA-9866 URL: https://issues.apache.org/jira/browse/KAFKA-9866 Project: Kafka Issue Type: Improvement Reporter: Stanislav Kozlovski The controller automatically triggers a preferred leader election every N minutes. It tries to elect all preferred leaders of partitions without doing some basic checks like whether the leader is in sync. This leads to a multitude of errors which cause confusion: {code:java} April 14th 2020, 17:01:11.015 [Controller id=0] Partition TOPIC-9 failed to complete preferred replica leader election to 1. Leader is still 0{code} {code:java} April 14th 2020, 17:01:11.002 [Controller id=0] Error completing replica leader election (PREFERRED) for partition TOPIC-9 kafka.common.StateChangeFailedException: Failed to elect leader for partition TOPIC-9 under strategy PreferredReplicaPartitionLeaderElectionStrategy {code} It would be better if the Controller filtered out some of these elections, not attempt them at all and maybe log an aggregate INFO-level log -- This message was sent by Atlassian Jira (v8.3.4#803005)