{"id":"8b9e9cf4-bd4c-4e7b-8cf7-861686b5f105","task":"Set up Patroni synchronous replication mode to prevent data loss on failover","domain":"patroni","steps":["In patroni.yml add synchronous_mode: true under the bootstrap.dcs section; Patroni will automatically designate one synchronous standby and update PostgreSQL's synchronous_standby_names","Set synchronous_mode_strict: false initially so that if no synchronous standby is available the primary can still accept writes; use true only if your RPO requires zero data loss at the cost of availability","Verify synchronous replication is active: on the primary check pg_stat_replication — the sync_state column should show sync for the designated standby","Test failover by stopping the primary node; Patroni should promote the synchronous standby; confirm with patronictl list that the new leader is the former synchronous standby","After promotion, Patroni automatically selects a new synchronous standby from remaining replicas and updates synchronous_standby_names; monitor the transition with patronictl history","Tune maximum_lag_on_failover alongside synchronous_mode so that asynchronous replicas with significant lag are not promoted accidentally if the synchronous standby is also unavailable"],"gotchas":["With synchronous_mode_strict: true, writes will block indefinitely if no synchronous standby is available (e.g., during a replica restart); ensure you have enough healthy replicas or use strict mode only in clusters where availability can be sacrificed for durability","Patroni's synchronous mode manages synchronous_standby_names dynamically; do not manually set synchronous_standby_names in postgresql.conf when using Patroni — it will be overwritten and may cause conflicts","A split-brain scenario is possible if the DCS (etcd/Consul) becomes partitioned; ensure the DCS cluster itself has a quorum of odd-numbered nodes across failure domains to prevent two nodes both believing they are primary"],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:12.974Z"},"url":"https://mcp.waymark.network/r/8b9e9cf4-bd4c-4e7b-8cf7-861686b5f105"}