← ClaudeAtlas

physical-replicationlisted

PostgreSQL's physical streaming replication — walsender (primary side, `replication/walsender.c`) + walreceiver (standby side, `replication/walreceiver.c`) + slots (`replication/slot.c`) + synchronous replication (`syncrep.c`). Covers the streaming protocol variant, hot standby, standby feedback, synchronous commit, WAL sender/receiver state machines, and the physical-slot semantics that differ from logical slots. Loads when the user asks about streaming replication, hot standby, `pg_basebackup`, synchronous_commit levels, walsender/walreceiver state, primary_conninfo, physical replication slots, standby feedback (`hot_standby_feedback`), or `pg_wal_replay_*` recovery-progress functions. Skip when the ask is about logical replication (`replication/logical/`) — sibling but very different code path.
matejformanek/postgres-claude · ★ 0 · AI & Automation · score 70
Install: claude install-skill matejformanek/postgres-claude
# physical-replication — streaming to a physical standby Physical (aka streaming, aka binary) replication ships raw WAL bytes from primary to standby. The standby applies them via the same recovery machinery used at startup — replaying block-level changes. Sibling to logical replication but MUCH simpler code path: no decoding, no output plugin, no per-row conflict handling. ## The file map | File | KB | Role | |---|---:|---| | `replication/walsender.c` | 134 | **Primary side.** The walsender is a backend spawned per replication connection. Reads WAL, sends it over the connection, handles feedback + syncrep signaling + timeline history. | | `replication/walreceiver.c` | 47 | **Standby side.** The walreceiver is a distinct aux process on the standby. Establishes libpq connection to primary's walsender, receives WAL, writes to local pg_wal, signals startup process to replay. | | `replication/walreceiverfuncs.c` | 11 | SQL-callable helpers on the standby side. | | `replication/slot.c` | 97 | Replication slot infrastructure — physical AND logical share this file for the base mechanics (create/drop/persistence). | | `replication/slotfuncs.c` | 28 | SQL-callable slot functions. | | `replication/syncrep.c` | 35 | Synchronous replication — primary waits for confirmed standby write / flush / apply based on `synchronous_commit`. | | `access/transam/xlogrecovery.c` | — | The startup process's WAL replay engine. Called on the standby to consume WAL from walreceiver. | | `backup/basebac