---
title: "kaf-mirror failover: latest skips unread Kafka records"
description: "kaf-mirror copies a Kafka topic but not consumer offsets. A lagging group fails over with latest, starts at the end of the copy and skips 4 unread records."
url: https://monedula.dev/kafka-simulator/scenarios/kaf-mirror-failover-latest/
---

# kaf-mirror failover: latest skips unread Kafka records

Scenario 20.2.2 · kaf-mirror failover: latest skips unread records. Cluster mirroring · Advanced · about 4 min · Apache Kafka 4.4 · Scalytics kaf-mirror v2.0.0.

g1 is 4 records behind when primary is lost. kaf-mirror carries no offsets, so latest starts g1 at the end of the copy on dr and it never reads O5-O8.

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

## What you start with

kaf-mirror copies a topic under the same name but does not translate or copy consumer offsets. After a failover each group starts on the copy at its auto.offset.reset. Here g1 keeps the Kafka default, latest, and is behind when primary is lost.

## 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=latest, the Kafka default. 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.2&t=0)
2. **g1 is 4 records behind** (t+1.300s): c1 stalled on a slow record after committing offset 4 (O1-O4). kaf-mirror kept copying: O1-O8 are at offsets 0-7 on primary and on dr, so the RPO is 0. g1's commit lives on primary only. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.2&t=1)
3. **primary is lost** (t+1.450s): The primary DC goes down: both brokers and its three controllers. g1 had read O1-O4. dr holds all 8 records. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.2&t=2)
4. **Failover: g1 starts at the end of dr** (t+1.650s): dr is promoted and orders there becomes writable. g1 moves to dr with no committed offset there, because nothing translated or copied its offset 4. auto.offset.reset=latest puts it at the end of the copy, offset 8: g1 will skip O5-O8 (offsets 4-7), which it never read. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.2&t=3)
5. **g1 reads only new records** (t+2.500s): c1 is back, and p1 writes D1 to dr at offset 8. g1 reads D1 (committed offset 9) but never O5-O8. The skip is silent: no error, no lag on g1. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.2&t=4)
6. **The skipped records are still on dr** (t+3.000s): g-audit, a new group at auto.offset.reset=earliest on dr, reads all 9 records, O5-O8 among them. They were never lost, only skipped by g1. To read them, g1 has to be reset on dr by hand. dr numbers its own offsets, so g1's offset from primary does not carry over. kaf-mirror v2.0.0 keeps the source timestamp, so a reset by time (--to-datetime) a little before g1's last processed record lands near the same place and reads a few records again. kaf-mirror has no failback. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=20.2.2&t=5)

## The takeaway

With latest, a failed-over group starts at the end of the copy and skips every record it had not read yet. The records are still in the log on dr, so a reset to an earlier offset or time, or a group at earliest, can read them; nothing in kaf-mirror does it for you. 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)
