Skip site navigation (1) Skip section navigation (2)

pgsql: Make standby server continuously retry restoring the next WAL

From: heikki(at)postgresql(dot)org (Heikki Linnakangas)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make standby server continuously retry restoring the next WAL
Date: 2010-01-27 15:27:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committerspgsql-docspgsql-hackers
Log Message:
Make standby server continuously retry restoring the next WAL segment with
restore_command, if the connection to the primary server is lost. This
ensures that the standby can recover automatically, if the connection is
lost for a long time and standby falls behind so much that the required
WAL segments have been archived and deleted in the master.

This also makes standby_mode useful without streaming replication; the
server will keep retrying restore_command every few seconds until the
trigger file is found. That's the same basic functionality pg_standby
offers, but without the bells and whistles.

To implement that, refactor the ReadRecord/FetchRecord functions. The
FetchRecord() function introduced in the original streaming replication
patch is removed, and all the retry logic is now in a new function called
XLogReadPage(). XLogReadPage() is now responsible for executing
restore_command, launching walreceiver, and waiting for new WAL to arrive
from primary, as required.

This also changes the life cycle of walreceiver. When launched, it now only
tries to connect to the master once, and exits if the connection fails, or
is lost during streaming for any reason. The startup process detects the
death, and re-launches walreceiver if necessary.

Modified Files:
        xlog.c (r1.361 -> r1.362)
        postmaster.c (r1.601 -> r1.602)
        walreceiver.c (r1.1 -> r1.2)
        walreceiverfuncs.c (r1.2 -> r1.3)
        walreceiver.h (r1.4 -> r1.5)
        pmsignal.h (r1.28 -> r1.29)


pgsql-docs by date

Next:From: Bruce MomjianDate: 2010-02-03 17:25:18
Subject: Re: Administration book proofreading
Previous:From: Bruce MomjianDate: 2010-01-22 23:04:04
Subject: Re: Problem building the documentation

pgsql-hackers by date

Next:From: Ivan Sergio BorgonovoDate: 2010-01-27 15:28:24
Subject: Re: C function accepting/returning cstring vs. text
Previous:From: Kevin GrittnerDate: 2010-01-27 15:27:22
Subject: Re: C function accepting/returning cstring vs. text

pgsql-committers by date

Next:From: Heikki LinnakangasDate: 2010-01-27 16:41:09
Subject: pgsql: Fix bug in wasender's xlogid boundary handling, reported by Erik
Previous:From: Peter EisentrautDate: 2010-01-27 14:52:00
Subject: Re: [COMMITTERS] pgsql: Remove tabs in SGML.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group