DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
- UNKNOWN: The partition has no cached state (broker just became leader, state not loaded yet). Not an explicit API-driven state, just the absence of state.
- PREPARING: The coordinator for this partition detects via onMetadataUpdate that it leads a mirror partition. It fetches last mirrored epochs from the source cluster and truncates logs to align the local log with the source.Valid from: UNKNOWN, MIRRORING, STOPPED.
- MIRRORING: All ISR set members have completed truncation. A mirror fetcher thread is started to continuously replicate records from the source cluster. Valid from: PREPARING, PAUSED.
- PAUSING: Triggered by the pause operation. The system removes fetchers for the affected partitions. Valid from: MIRRORING only.
- PAUSED: Fetchers have been removed. The partition stays read-only with no active fetchers and no metadata sync (configs, consumer groups, ACLs). On resume, transitions directly to MIRRORING. Valid from: PAUSING only.
- STOPPING: Triggered by the remove topics from mirror operation or topic deletion on the source. The system stores the last mirrored epoch to Performs the following actions.
- Remove mirror fetcher threads: Stops cross-cluster replication for the affected partitions.
- In parallel:
- Bump leader epoch (async): Sends a BumpLeaderEpochsRequest to the controller with the latest local log epoch as minLeaderEpoch, ensuring the destination leader epoch exceeds the source cluster's last known epoch.
Truncate to LSO, then update LME: Truncates each partition's log to LSO, discarding any uncommitted tail, then persists the latest leader epoch from each partition's log into the __mirror_state
coordinator topic, recording LME for future failback.
- Write PID reset barrier: Once both parallel branches complete, appends a MIRROR_PID_RESET control record to each partition, fencing stale producer IDs from the source cluster.
- STOPPED: The last mirrored epoch have been persisted. The topic becomes writable on the destination cluster. Tthe The mirror fetcher is removed and the read-only flag is cleared. Valid from: STOPPING only.
- FAILED: An error occurred. Valid from: any state. The operator that wants to restart a failed mirror partition can remove the topic from the mirror and add it back again. The STOPPING handler already removes fetchers and truncates to the LSO, both of which are safe operations on a failed partition (fetchers are likely already gone, and truncation is a best-effort cleanup). More sophisticated recovery strategies can be added later with a follow-up KIP.
...
- Starting a mirror (UNKNOWN -> PREPARING -> MIRRORING): The addTopicsToMirror command StartMirrorTopics command sets mirror.name config via the controller. The metadata update propagates to brokers. The broker leading the partition finds out the partition state via the coordinator, and this might trigger readMirrorState RPC to query from the remote coordinator responsible for handling that mirror partition, and transitions to PREPARING if it's in a valid transition state. After truncation completes, it moves to MIRRORING and starts the mirror fetcher to fetch data from the source cluster.
- Failing over to destination (MIRRORING -> STOPPING -> STOPPED): The removeTopicsFromMirror command StopMirrorTopics command appends the ".removed” suffix to the mirror.name config. The partition leader detects the stop request, transitions to STOPPING, truncates to LSO, persists the last mirrored epoch, then moves to STOPPED. The topic is now writable after the STOPPED state.
- Restarting a stopped mirror (STOPPED -> PREPARING -> MIRRORING): The mirror.name config is set again. The controller is notified, sees the partition in STOPPED state and transitions to PREPARING, re-truncating and resuming replication.
...
RPC | Component | ACL Operation | ACL Resource | Purpose |
| CreateMirror | Controller | Create | ClusterMirror | New cluster mirror creation |
| AddTopicsToMirrorStartMirrorTopics | Controller | Alter | ClusterMirror | Mirror topics creation |
| AddTopicsToMirrorStartMirrorTopics | Controller | AlterConfigs | Topic | Mirror topics creation |
| RemoveTopicsFromMirrorStopMirrorTopics | Controller | Alter | ClusterMirror | Mirror topics removal (failover) |
| RemoveTopicsFromMirrorStopMirrorTopics | Controller | AlterConfigs | Topic | Mirror topics removal (failover) |
| PauseMirrorTopics | Controller | Alter | ClusterMirror | Mirror topics pause |
| PauseMirrorTopics | Controller | AlterConfigs | Topic | Mirror topics pause |
| ResumeMirrorTopics | Controller | Alter | ClusterMirror | Mirror topics resume |
| ResumeMirrorTopics | Controller | AlterConfigs | Topic | Mirror topics resume |
| DeleteMirror | Controller | Alter | ClusterMirror | Delete a cluster mirror |
| ListMirrors | Broker | Describe | ClusterMirror | Mirror topic listing |
| DescribeMirrors | Broker | Describe | ClusterMirror | Mirror topic describe (state, lag) |
| DescribeConfigs | Broker | DescribeConfigs | ClusterMirror | Mirror configuration describe |
| WriteMirrorStates | MC | ClusterAction | Cluster | Mirror partition state write |
| ReadMirrorStates | MC | ClusterAction | Cluster | Mirror partition state read |
| BumpLeaderEpochs | MC | ClusterAction | Cluster | Leader epoch bump when stopping |
| FindCoordinator | Broker | ClusterAction | Cluster | Mirror coordinator location |
| CreateTopics | MMM | Create | Topic | Topic creation |
| CreatePartitions | MMM | Alter | Topic | Partitions scaling |
| IncrementalAlterConfigs | MMM | AlterConfigs | ClusterMirror | Mirror configuration update |
| OffsetCommit | MMM | Read | Topic | Source CG offsets commit |
| OffsetCommit | MMM | Read | Group | Source CG offsets commit |
| CreateAcls | MMM | Alter | Cluster | Source ACLs creation |
| DeleteAcls | MMM | Alter | Cluster | Source ACLs removal |
...
Failover is initiated by calling the RemoveTopicsFromMirror APIStopMirrorTopics API, which appends a ".removed" suffix to the mirror.name internal config. This transitions the mirror topics from read-only to writable state after the stopping process completes gracefully. When producers reconnect to the destination cluster after failover, they obtain new producer IDs which are separate from previously mirrored IDs, so they begin writing with fresh sequence numbers starting from 0. Consumers can reconnect to the destination cluster using the same group ID, resuming from the last synchronized offsets, minimizing data re-processing or gaps. The transition is transparent from the consumer's perspective and offset management continues normally through the destination's group coordinator.
...
| Code | Name | Message | Used By |
|---|---|---|---|
| 3 | UNKNOWN_TOPIC_OR_PARTITION | The topic does not exist on the target cluster | RemoveTopicsFromMirrorStopMirrorTopics, PauseMirrorTopics, ResumeMirrorTopics |
| 15 | COORDINATOR_NOT_AVAILABLE | The mirror coordinator is not active | WriteMirrorStates, ReadMirrorStates |
| 31 | CLUSTER_AUTHORIZATION_FAILED | The client is not authorized to perform the mirror operation | WriteMirrorStates, ReadMirrorStates |
| 35 | UNSUPPORTED_VERSION | Cluster mirroring is disabled (mirror.version=0) | CreateMirror, AddTopicsToMirrorStartMirrorTopics, RemoveTopicsFromMirrorStopMirrorTopics, PauseMirrorTopics, ResumeMirrorTopics, ListMirrors, DescribeMirrors, DeleteMirror |
| TBD | MIRROR_AUTHORIZATION_FAILED | Mirror authorization failed | CreateMirror, AddTopicsToMirrorStartMirrorTopics, RemoveTopicsFromMirrorStopMirrorTopics, PauseMirrorTopics, ResumeMirrorTopics, DeleteMirror |
| TBD | READ_ONLY_TOPIC | The topic is read-only because it is a mirror topic on the target cluster | Produce |
| TBD | INVALID_MIRROR_NAME | The mirror name does not meet the naming rules | CreateMirror |
| TBD | UNKNOWN_MIRROR | The topic is not assigned to any mirror | RemoveTopicsFromMirrorStopMirrorTopics, PauseMirrorTopics, ResumeMirrorTopics |
| TBD | TOPIC_ALREADY_IN_MIRROR | The topic is already assigned to a mirror | AddTopicsToMirrorStartMirrorTopics |
| TBD | TOPIC_NOT_IN_MIRROR | The topic does not belong to the specified mirror | RemoveTopicsFromMirrorStopMirrorTopics, PauseMirrorTopics, ResumeMirrorTopics |
| TBD | MIRROR_TOPIC_ALREADY_PAUSED | The mirror topic is already paused | PauseMirrorTopics |
| TBD | MIRROR_TOPIC_NOT_PAUSED | The mirror topic is not paused | ResumeMirrorTopics |
| TBD | MIRROR_TOPIC_BEING_REMOVED | The mirror topic is being removed | ResumeMirrorTopics |
| TBD | MIRROR_NOT_EMPTY | The mirror still has active or non-removed topics | DeleteMirror |
...
- CLI Workflow: Create mirror with kafka-mirrors.sh, add topicsstart mirroring, verify replicationlog convergence
- Basic Replication: Create mirror via API, replicate topicstart mirroring, verify data consistencylog convergence
- Metadata Sync: Modify topic config in source, verify automatic sync to destination
- Partition Expansion: Add partitions to source topic, verify destination expands
- Consumer Groups: Commit offsets in source, verify replication to destination
- ACL Replication: Create ACL in source, verify creation in destination
- Leader Changes: Trigger leader election in source, verify fetcher reconnects
- Broker Failures: Stop destination broker, verify replication continues after recovery
...