Sequence synchronization coordinates generated identifiers across database nodes so replicated writes do not reuse primary-key values. In bidirectional logical replication, each node must avoid generating numbers already used elsewhere. section 5.5
The duplicate-key failure
After alpha inserts rows with IDs 1 and 2, beta’s sequence may still be at 1. Inserting a row on beta then fails with duplicate key value violates unique constraint "tickets_pkey" because ID 1 already exists.
Common coordination strategies expose different operational costs:
- Keep the entire cluster synchronized after every write, preserving coordination at the cost of disastrous performance. section 5.5
- Pre-allocate distinct identifier ranges to nodes, accepting administrative work for allocation, exhaustion, and new-node management. section 5.5
