Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Cluster mirroring enforces the invariant that the destination leader epoch (DLE) is always greater than or equal to the source leader epoch (DLE >= SLE). This invariant is required to prevent a liveness problem in destination consumers.

When a destination consumer initializes a partition, it retrieves the last committed offset along with its leader epoch from the group coordinator. If the committed leader epoch originates from the source cluster and is greater than the local leader epoch, the consumer's Metadata.updateLastSeenEpochIfNewer accepts it, causing all subsequent metadata updates from the destination cluster to be filtered out. The partition enters AWAIT_VALIDATION but requests cannot be sent because the partition has no known leader node. This creates an infinite loop of metadata refreshes that never resolves.

Enforcing DLE >= SLE guarantees that committed offsets from the source cluster always carry an epoch lower than the destination's current epoch, so destination consumers can validate positions normally. Before appending mirrored data, the destination sets DLE = SLE + LEADER_EPOCH_BUMP_INCREMENT whenever SLE > DLE − LEADER_EPOCH_BUMP_THRESHOLD. The chosen increment is 10 and the threshold is 3, which provides a window of 7 source leader elections before the next bump. These two constants are a tradeoff: larger values mean fewer epoch bumps but faster epoch consumption, smaller values mean more bumps but slower epoch growth.

...