---
title: "kaf-mirror failover: Kafka consumers re-read from earliest"
description: "kaf-mirror copies a Kafka topic but not consumer offsets. After the failover the group starts at the log start on dr and reads all 8 records a second time."
url: https://monedula.dev/kafka-simulator/scenarios/kaf-mirror-failover-earliest/
---

# kaf-mirror failover: Kafka consumers re-read from earliest

Scenario 20.2.1 · kaf-mirror failover: earliest reads everything again. Cluster mirroring · Advanced · about 4 min · Apache Kafka 4.4 · Scalytics kaf-mirror v2.0.0.

kaf-mirror copies orders under the same name but not the consumer offsets. After the failover g1 starts at the log start on dr and reads all 8 records twice.

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

## What you start with

kaf-mirror copies a topic into another cluster under the same name, partition for partition, but it does not translate or copy consumer offsets. After a failover each group starts on the copy wherever its auto.offset.reset puts it. Here g1 uses earliest.

## Step by step

1. **kaf-mirror copies orders to dr** (t+0.000s): kaf-mirror consumes orders on primary and produces each record into orders on dr, partition 0 to partition 0, under the same name. It keeps no offset map and copies no consumer offsets. g1 reads orders on primary with auto.offset.reset=earliest. Until a failover the copy on dr is read-only (the simulator's choice: kaf-mirror itself does not block writes to it). [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=0)
2. **Caught up on both sides** (t+1.300s): O1-O8 are at offsets 0-7 on primary and on dr, so the RPO is 0. g1 has read and committed all 8 on primary (committed offset 8). That commit lives on primary only: kaf-mirror does not copy it to dr. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=1)
3. **primary is lost** (t+1.450s): The primary DC goes down: both brokers and its three controllers. kaf-mirror can no longer read from it. dr still holds all 8 records. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=2)
4. **Failover: g1 starts at offset 0 on dr** (t+1.650s): dr is promoted and orders there becomes writable. g1 moves to dr, where it has no committed offset, because nothing translated or copied its offset 8. auto.offset.reset=earliest puts it at the start of the copy: offset 0. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=3)
5. **All 8 records read a second time** (t+1.850s): c1 polls O1-O8 again from dr and commits offset 8 there. Every record g1 had already processed on primary is processed twice: nothing is missed, but the application must tolerate the duplicates. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=4)
6. **New writes on dr are read once** (t+2.500s): p1 writes D1 to dr at offset 8 and g1 reads it once (committed offset 9). kaf-mirror has no failback: going back to primary would take a new job in the other direction, which the simulator does not model. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.1&t=5)

## The takeaway

Without offset translation, auto.offset.reset decides where a failed-over group starts. earliest skips nothing that reached the copy (records not yet copied are gone whatever the reset), but reads the whole copy again, so the application must handle every record twice (idempotent processing). kaf-mirror has no failback: going back to primary means a new job in the other direction.

## Configs in this scenario

- [`auto.offset.reset`](https://kafka.apache.org/44/configuration/consumer-configs/#consumerconfigs_auto.offset.reset): Where a consumer starts when its group has no committed offset or the offset no longer exists: latest (the default), earliest, by_duration (a time back from now, such as by_duration:PT1H), or none to throw an exception instead. [How auto.offset.reset works](https://monedula.dev/kafka/configs/auto-offset-reset/)

## Further reading

- [kaf-mirror v2.0.0 source on GitHub](https://github.com/scalytics/kaf-mirror/blob/v2.0.0/README.md)
