---
title: "Apache Kafka Cluster Mirroring (KIP-1279): stop and failback"
description: "KIP-1279 mirror: stop loses O4 and aborts an open transaction on the mirror, which the source later commits. A reverse mirror truncates primary and fails back."
url: https://monedula.dev/kafka-simulator/scenarios/cluster-mirroring-stop-failback/
---

# Apache Kafka Cluster Mirroring (KIP-1279): stop and failback

Scenario 20.1.6 · Cluster Mirroring: stop and fail back. Cluster mirroring · Advanced · about 5 min · Apache Kafka 4.4.

Apache Kafka's own offset-preserving mirror (KIP-1279, accepted, not yet released): there is no planned promote, the cutover is --stop, and a transaction still open at the source is aborted on the mirror.

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

## What you start with

KIP-1279 puts cluster mirroring into Apache Kafka: the destination partition leaders fetch from the source and keep the same offsets, and the mirror keeps the source name and rejects produces with READ_ONLY_TOPIC. It was accepted in September 2026 but is not in an Apache Kafka release yet; when it ships, it sits behind the mirror.version feature flag. In this run a transaction on primary is still open when the mirror is paused and then stopped, so the stop aborts it on dr, while primary commits it afterwards. dr then takes a write of its own, D1, before the topic fails back to primary.

## Step by step

1. **A cluster mirror, primary → dr** (t+0.000s): A KIP-1279 cluster mirror copies orders from primary into a read-only orders on dr: same name, no prefix, and the same offsets, because each dr partition leader fetches from primary with a MirrorFetcherThread. A produce to orders on dr fails with READ_ONLY_TOPIC. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=0)
2. **An open transaction is mirrored too** (t+0.900s): O1-O3 sit at offsets 0-2 on both sides. The transaction then writes T1 and T2 at offsets 3 and 4 and stays open, so primary's LSO holds at 3, yet the mirror copied them: it fetches READ_UNCOMMITTED. Both copies are at high watermark 5. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=1)
3. **Paused: O4 stays on primary** (t+1.100s): kafka-cluster-mirrors --pause removed the fetchers. The mirror stays read-only and copies nothing, so O4 (offset 5) is on primary only: dr is 1 record behind. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=2)
4. **Stop: writable now, the open transaction aborted** (t+1.250s): kafka-cluster-mirrors --stop is the only cutover KIP-1279 has: it does not wait for lag 0. orders on dr is writable, O4 never reached it (RPO 1), and the stop bumps dr's leader epoch from ε0 to ε1, the line between mirrored records and dr's own. It also appends ABORT markers for the transaction still open on primary, so offsets 3-4 are aborted on dr (the faded, struck-through cells). read_committed consumers there skip them. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=3)
5. **primary commits what dr aborted** (t+1.400s): The transactional producer commits on primary: T1 and T2 are committed there, primary's LSO moves to 6, while dr keeps them aborted, so for now the two copies disagree. Exactly-once does not cross clusters. That is not a KIP-1279 design choice: any asynchronous cross-cluster replication can stop between a transaction's records and its commit. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=4)
6. **dr takes its own write** (t+1.650s): D1 is produced on dr at offset 5, the offset O4 holds on primary: the two logs have diverged past the stop point. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=5)
7. **Fail back: truncate and mirror back** (t+2.200s): The failback is a reverse mirror, dr → primary. It truncates orders on primary to the end of the last mirrored epoch, offset 5, where dr's epoch 1 begins, which deletes O4 and the COMMIT marker primary wrote after it, makes it a read-only mirror, and copies dr's log back from there: the stop's ABORT marker, then D1. dr is not truncated: it is the source now and keeps its log as it is. The two logs converge, so offsets 3-4 are now aborted on primary too. In Kafka every marker takes an offset (the ABORT at 5, D1 at 6); the simulator's markers take none, so D1 shows at 5. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.1.6&t=6)

## The takeaway

Stop is the only cutover in KIP-1279: it never waits for lag 0, so O4 is lost on dr, and it appends ABORT markers for the transactions still open at the source, so T1 and T2 are aborted on dr even though primary commits them later. It also bumps dr's leader epoch, which marks where dr's own writes begin. Exactly-once does not cross clusters, and no asynchronous cross-cluster replication can make it: a stop can always fall between a transaction's records and its commit. Failing back is a reverse mirror: it truncates primary to the end of the last mirrored epoch, the stop point, which drops O4 and primary's COMMIT marker, and copies dr's log back at the same offsets, ABORT marker included, so both copies end with T1 and T2 aborted.

## Further reading

- [KIP-1279 on the Apache Kafka wiki](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1279%3A+Cluster+Mirroring)

## Kafka proposals behind this scenario

- [KIP-1279 explained: Apache Kafka Cluster Mirroring](https://monedula.dev/kafka/kips/kip-1279/)
