From: Michael Paquier <michael@paquier.xyz>
To: Richard Schmidt <Richard.Schmidt@metservice.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Pg_rewind cannot load history wal
Date: Sat, 4 Aug 2018 05:59:22 +0900
Message-ID: <20180803205922.GC20967@paquier.xyz> (raw)
In-Reply-To: <HK0PR01MB200359DEA9A85774C9E3A799912D0@HK0PR01MB2003.apcprd01.prod.exchangelabs.com>
References: <HK0PR01MB200359DEA9A85774C9E3A799912D0@HK0PR01MB2003.apcprd01.prod.exchangelabs.com>
On Wed, Aug 01, 2018 at 09:09:30PM +0000, Richard Schmidt wrote:
> Our procedure that runs on machine A and B is as follows:
>
> 1. Build new databases on A and B, and configure A as Primary and B
> as Standby databases.
> 2. Make some changes to the A (the primary) and check that they are
> replicated to the B (the standby)
> 3. Promote B to be the new primary
> 4. Switch of the A (the original primary)
> 5. Add the replication slot to B (the new primary) for A (soon to
> be standby)
> 6. Add a recovery.conf to A (soon to be standby). File contains
> recovery_target_timeline = 'latest' and restore_command = 'cp
> /ice-dev/wal_archive/%f "%p"
> 7. Run pg_rewind on A - this appears to work as it returns the
> message 'source and target cluster are on the same timeline no
> rewind required';
> 8. Start up server A (now a slave)
Step 7 is incorrect here, after promotion of B you should see pg_rewind
actually do its work. The problem is that you are missing a piece in
your flow in the shape of a checkpoint on the promoted standby to run
after 3 and before step 7. This makes the promoted standby update its
timeline number in the on-disk control file, which is used by pg_rewind
to check if a rewind needs to happen or not.
We see too many reports of such mistakes, I am going to propose a patch
on the -hackers mailing list to mention that in the documentation...
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: michael@paquier.xyz, Richard.Schmidt@metservice.com
Subject: Re: Pg_rewind cannot load history wal
In-Reply-To: <20180803205922.GC20967@paquier.xyz>
References: <HK0PR01MB200359DEA9A85774C9E3A799912D0@HK0PR01MB2003.apcprd01.prod.exchangelabs.com> <20180803205922.GC20967@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox