Scenario 03.2.6 · Eligible leader replicas (KIP-966)
Kafka Eligible Leader Replicas (KIP-966) in action
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 this scenario in the playgroundCluster 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: step 1, Cluster ready - eligible leader replicas ON2 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: step 2, 2 records committed on all threebroker-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: step 3, broker-3 throttled out of ISR - not eligiblebroker-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: step 4, broker-2 throttled out - ISR below min.ISR, broker-2 joins the ELRbroker-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: step 5, broker-1 killed - ISR empty, ELR is broker-1, broker-2broker-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: step 6, broker-2 elected from the ELR - clean, no data lossbroker-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: step 7, broker-3 catches up - ISR back at min.ISR, ELR clearedWhat 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
- 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: step 1, Cluster ready - eligible leader replicas ON
- 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: step 2, 2 records committed on all three
- 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: step 3, broker-3 throttled out of ISR - not eligible
- 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: step 4, broker-2 throttled out - ISR below min.ISR, broker-2 joins the ELR
- 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: step 5, broker-1 killed - ISR empty, ELR is broker-1, broker-2
- 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: step 6, broker-2 elected from the ELR - clean, no data loss
- 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: step 7, broker-3 catches up - ISR back at min.ISR, ELR cleared
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.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 worksinsync. replicas -
unclean.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 worksleader. election. enable -
acksHow 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
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=03.2.6" title="Kafka Simulator: Eligible leader replicas (KIP-966)" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/eligible-leader-replicas/">Kafka Eligible Leader Replicas (KIP-966) in action</a></p> Further reading
Kafka proposals behind this scenario
Troubleshooting
- NotEnoughReplicasException in Kafka: causes and fixes
- TimeoutException in Kafka producers: causes and fixes
More in Replication
- Kafka ISR (in-sync replicas): how replicas leave and rejoin
- Watch Kafka min.insync.replicas in a live simulation
- Kafka slow follower: replica.lag.time.max.ms and the ISR
- Kafka high watermark pinned by a slow in-sync replica
- Losing two Kafka brokers with min.insync.replicas=2
- Kafka preferred leader election after a rack failure
- Watch Kafka unclean.leader.election.enable in a simulation
- Kafka unclean leader election: permanent loss of acked data
- Kafka log truncation when an old leader returns
- Kafka broker.rack: rack-aware replica placement
- Kafka rack-aware reassignment after adding a rack
- Increase the replication factor of an existing Kafka topic