Monedula
Kafka guide contents

Markdown

Part VI · Reference

Kafka Improvement Proposal

KIP-966: Eligible Leader Replicas, a safe leader when the ISR is empty

Cluster and operations · Shipped · since Kafka 4.0 · status checked November 2026

KIP-966 lets Kafka elect a safe leader in cases where it used to have none. Because the high watermark only moves while the ISR has at least min.insync.replicas members, a replica that dropped out of the ISR at that point still holds every committed record. The controller now tracks those replicas as eligible leaders and can elect one when the ISR is empty.

Proposal
KIP-966, Eligible Leader Replicas
Status
Shipped Preview in Kafka 4.0; on by default for clusters created with 4.1 or later.
Area
Cluster and operations
broker-2 elected from the ELR - clean, no data loss. The ISR is empty, so the controller picks an unfenced ELR member: broker-2 leads with HW 5, every committed record intact. The stale broker-3 (LEO 2) is never a candidate, and broker-1 stays in the ELR while it is down. Writes still wait: the ISR (broker-2 alone) is below min.ISR, so acks=all produces fail with NOT_ENOUGH_REPLICAS. Open this step in the full playground

Why it was needed

When every ISR member was gone, Kafka had two bad options: keep the partition offline until an ISR member came back, or allow an unclean election and lose committed records. Yet often a replica that had just left the ISR was perfectly up to date; Kafka simply did not know it was safe.

What it changes

The controller stores, per partition, the replicas that left the ISR while it was below min.insync.replicas: the Eligible Leader Replicas. Election order becomes ISR first, then a live eligible replica, then the last known leader. ELR also makes min.insync.replicas a cluster-level setting, so a broker-level value can no longer be changed.

How to use it

  • Clusters created with Kafka 4.1 or later have it on. On an upgraded cluster enable the eligible.leader.replicas.version=1 feature with kafka-features.sh; downgrading to 0 is safe.
  • Watch the ElectionFromEligibleLeaderReplicasPerSec metric to see it at work.

Where it stands

Part one shipped as a preview in Kafka 4.0 and is enabled by default on new clusters since Kafka 4.1. The unclean recovery part of the KIP, a smarter replacement for unclean leader election, has not shipped.

What comes next

The remaining work is unclean recovery: a strategy for picking the replica with the most data when no safe one is left. Deprecating unclean.leader.election.enable waits on it.

See it in the simulator

Scenario 03.2.6 turns ELR on and shows a replica outside the ISR elected with no data loss; 03.2.4 and 03.2.3 show the dilemma without it. ELR is on only in that scenario: free play and the others keep the pre-4.1 rules. The simulator picks the first live ELR member in assignment order, treats a hard kill as an unclean shutdown, and leaves out the last-known-leader step.

Sources

All Kafka KIPs