Versions Compared

Key

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

A producer ID (PID) is a 64-bit identifier assigned by the broker to each idempotent or transactional producer. It has three key properties:

  1. Unique: uniquely identifies a producer for idempotent deduplication and transaction tracking.
  2. Stable: once assigned, a PID persists across producer sessions (for transactional producers) or until expiration.
  3. Non-negative: valid PIDs are >= 0. The value -1 (NO_PRODUCER_ID) marks non-idempotent batches.

...

The barrier approach works correctly with all practical mirroring topologies:                                                                                                                                                                                                            

  • Active-passive (A to B): B mirrors from A, stores records as-is. On failover, barrier expires all PSM entries. Local producers get fresh PIDs from the coordinator with no collision risk.                                                                                            
  • Failback (A to B, then B to A): After failover, B becomes writable. Later, A starts mirroring from B, stores B's records

    as-is

    as─is. B's barrier record is included in the fetched data and appended to A's log, but it does not trigger PSM expiration on A.

    The propagated barrier is inert during active mirroring: it sits in the log as a passive control batch

    This is because A is actively mirroring, not transitioning. Its PSM state reflects the mirrored data it is currently tracking, and wiping it mid─stream would break producer state consistency for the ongoing mirroring operation. When A later stops mirroring from B, A

    's

    writes its own barrier

    expires all PSM entries

    , which is the correct trigger for PSM expiration on A, producing a clean slate before A becomes writable again. The cycle can repeat safely in either direction because each failover produces clean PSM state via the barrier, and each new mirroring session starts from a truncated,

    offset-aligned

    offset─aligned log.

  • Fan-out (A to B, A to C): B and C mirror independently from A, each with its own PSM per partition. On failover, each writes its own barrier independently.
  • Fan-in (A to C, B to C, different topics): Each topic's partitions have independent PSMs. The barrier is written per partition during the STOPPING transition of each mirror.
  • Chain (A to B to C): B mirrors from A, stores records as-is. C mirrors from B, stores records as-is. On failover at any point in the chain, the barrier expires all PSM entries on the stopping node. Longer chains work inductively by the same principle.

...