Skip to content- Sources: primary
- Summary: Shlomi Noach describes how Neki's Admin control plane declares a Postgres primary dead only when at least one reachable replica reports broken replication through pg_stat_wal_receiver and none contradict it. Before promotion, Admin breaks each replica's primary_conninfo hostname so a returning primary cannot regain acknowledgers under synchronous_standby_names ANY 1, then promotes the replica with the highest received WAL position. The old primary is marked TEARDOWN and kept for postmortem rather than rejoined.
- Why it matters: It gives a concrete fencing and candidate-selection recipe for anyone building automated Postgres failover on core physical replication.