---
title: "Kafka Eligible Leader Replicas (KIP-966) in action"
description: "The whole ISR of a Kafka partition dies, yet broker-2, an up-to-date replica outside it, is elected from the ELR with no data loss. A stale one never leads."
url: https://monedula.dev/kafka-simulator/scenarios/eligible-leader-replicas/
---

# Kafka Eligible Leader Replicas (KIP-966) in action

Scenario 03.2.6 · Eligible leader replicas (KIP-966). Replication · Advanced · about 4 min · Apache Kafka 4.4.

With eligible.leader.replicas on, an up-to-date replica outside the ISR can still lead: the ISR empties and the partition comes back with no data loss.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6

## What you start with

Kafka 4.1+ clusters run Eligible Leader Replicas (KIP-966, feature eligible.leader.replicas.version=1). The high watermark then only moves while the ISR has at least min.insync.replicas members, so a replica that leaves an ISR already below min ISR still holds every committed record. Here orders has RF 3 and min ISR 2, unclean election is off, and two followers fall behind one after the other before the leader dies.

## Step by step

1. **Cluster ready - eligible leader replicas ON** (t+0.000s): orders has RF 3 and min.ISR 2, unclean.leader.election.enable is off, and the cluster runs eligible.leader.replicas.version=1: the controller tracks, per partition, the replicas that are out of the ISR but hold every committed record. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=0)
2. **2 records committed on all three** (t+4.100s): High-watermark is 2 - every replica holds both records. The ISR is broker-1, broker-2, broker-3 and the ELR is empty. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=1)
3. **broker-3 throttled out of ISR - not eligible** (t+12.100s): broker-3 froze at LEO 2 and left the ISR while the ISR still had min.ISR members, so the high watermark kept moving without it: HW is now 5. broker-3 is behind, so it does NOT join the ELR. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=2)
4. **broker-2 throttled out - ISR below min.ISR, broker-2 joins the ELR** (t+20.600s): broker-2 left the ISR too, so the ISR (broker-1 alone) is below min.ISR. With ELR on, the high watermark stops at 5: O6-O8 sit on the leader only and are never acknowledged. broker-2 holds every committed record (LEO 5 = HW), so the controller records it as an eligible leader replica. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=3)
5. **broker-1 killed - ISR empty, ELR is broker-1, broker-2** (t+24.100s): The leader died hard. The partition has no ISR member left, and that last ISR member joins the ELR as well. Before KIP-966 this was the dead end of 03.2.3: stay offline, or elect the stale replica and lose data. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=4)
6. **broker-2 elected from the ELR - clean, no data loss** (t+24.600s): 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 at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=5)
7. **broker-3 catches up - ISR back at min.ISR, ELR cleared** (t+28.600s): broker-3 fetched records 2-4 from broker-2 and rejoined: the ISR is broker-2, broker-3, back at min.ISR, so the high watermark may move again and the controller empties the ELR. Nothing the producer was told is committed was lost; O6-O8 were never acknowledged. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.2.6&t=6)

## The takeaway

The whole ISR died, yet the partition is back with every committed record: the controller elected broker-2 from the ELR, not the stale broker-3. Without ELR this ends like 03.2.3, offline, or like 03.2.4, a stale leader and lost records. The price is paid up front: while the ISR is below min ISR, the high watermark does not move and acks=all writes are not acknowledged.

## Configs in this scenario

- [`min.insync.replicas`](https://kafka.apache.org/44/configuration/topic-configs/#topicconfigs_min.insync.replicas): The fewest in-sync replicas, leader included, that must have a write for an acks=all produce to succeed (default 1); with fewer in the ISR the leader rejects the write with NOT_ENOUGH_REPLICAS. [How min.insync.replicas works](https://monedula.dev/kafka/configs/min-insync-replicas/)
- [`unclean.leader.election.enable`](https://kafka.apache.org/44/configuration/topic-configs/#topicconfigs_unclean.leader.election.enable): Lets a replica that is not in the ISR become leader when no in-sync replica is left, which brings the partition back online but loses the writes that replica never received (default false). [How unclean.leader.election.enable works](https://monedula.dev/kafka/configs/unclean-leader-election-enable/)
- [`acks`](https://kafka.apache.org/44/configuration/producer-configs/#producerconfigs_acks): How many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). [How acks works](https://monedula.dev/kafka/configs/acks/)

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/44/operations/eligible-leader-replicas/)

## Kafka proposals behind this scenario

- [KIP-966 explained: Eligible Leader Replicas (ELR)](https://monedula.dev/kafka/kips/kip-966/)

## Troubleshooting

- [NotEnoughReplicasException in Kafka: causes and fixes](https://monedula.dev/kafka/troubleshooting/not-enough-replicas/)
- [TimeoutException in Kafka producers: causes and fixes](https://monedula.dev/kafka/troubleshooting/producer-timeout-exception/)
