Skip to content

Multi-Master Databases (BDR / Spock / pgactive)

Running in a multi-master environment

pg_relay supports both multi-master (Spock active-active) clusters and single-primary failover-follow deployments, through the Processor's --mode parameter. The complete design and operator's guide — mode selection, the snowflake-ID and replication model, conservative node adoption and leader election, latency, and the split-brain trade-off — lives in its own dedicated book: Multi-Master Deployment.

The updated_at trigger is origin-only

The BEFORE UPDATE trigger on pgrelay.actions that maintains the updated_at column is set to be "origin-only" (in PostgreSQL replication terms, NOT ENABLE ALWAYS). This means it only fires on the node where the change originated, not on other nodes that are simply applying a replicated copy of that change. The purpose is to preserve the original updated_at timestamp when a channel update is replicated — if the trigger fired again on the receiving node, it would overwrite the timestamp with the time the replica applied the change, rather than when the change actually happened.


Continue to Purging Historical Data for how to keep pgrelay.log and pgrelay.queue from growing without bound.