liveBook · Manning

Replication origin

As explained in PostgreSQL Mistakes and How to Avoid Them

A replication origin records the database or node from which a replicated transaction originally came.

A replication origin records the database or node where a replicated transaction began. Logical replication must distinguish local changes from changes arriving from other nodes. section 5.5

A tempting multi-master setup publishes every table in both directions without filtering origins. Each node can then replicate transactions it previously received, creating a feedback loop that ping-pongs WAL until disks fill with extraneous data. section 5.5

Filter forwarded transactions

For a native logical replication subscription, use WITH (origin=NONE); the equivalent pglogical setting is forward_origins='{}'. Creating the second subscription can warn that initial copied rows may have a different origin, so verify the initial data before proceeding.

Replication-origin context also appears in failures: a missing replicated column is reported while processing remote data for a named replication origin, identifying the replication path involved.

How PostgreSQL Mistakes and How to Avoid Them covers it

How deep it goes
Explains origin tracking, feedback-loop consequences, configuration options, warnings, and diagnostic log context.
Examples
Uses bidirectional alpha-beta replication, origin=NONE, forward_origins, and an origin-labeled missing-column error.
What it assumes
Assumes familiarity with PostgreSQL logical replication, WAL, publications, subscriptions, and multi-node operation.
What you can do after
Configure origin filtering and diagnose logical replication failures using subscription settings and worker logs.
How it connects
Connects replication origins with logical replication, WAL, publications, subscriptions, and multi-master replication.

This explainer was generated by Manning's knowledge graph from the text of PostgreSQL Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.