forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1bb2558
committed
Make standby server continuously retry restoring the next WAL segment with
restore_command, if the connection to the primary server is lost. Thisensures that the standby can recover automatically, if the connection islost for a long time and standby falls behind so much that the requiredWAL segments have been archived and deleted in the master.This also makes standby_mode useful without streaming replication; theserver will keep retrying restore_command every few seconds until thetrigger file is found. That's the same basic functionality pg_standbyoffers, but without the bells and whistles.To implement that, refactor the ReadRecord/FetchRecord functions. TheFetchRecord() function introduced in the original streaming replicationpatch is removed, and all the retry logic is now in a new function calledXLogReadPage(). XLogReadPage() is now responsible for executingrestore_command, launching walreceiver, and waiting for new WAL to arrivefrom primary, as required.This also changes the life cycle of walreceiver. When launched, it now onlytries to connect to the master once, and exits if the connection fails, oris lost during streaming for any reason. The startup process detects thedeath, and re-launches walreceiver if necessary.1 parentab13d1e commit1bb2558
File tree
6 files changed
+538
-550
lines changed- src
- backend
- access/transam
- postmaster
- replication
- include
- replication
- storage
6 files changed
+538
-550
lines changed0 commit comments
Comments
(0)