From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: pgbackrest - question about restoring cluster to a new cluster on same server
Date: Wed, 18 Sep 2019 21:06:50 -0500
Message-ID: <cdf0f274-d94c-994c-6765-97a50fb9eae8@gmail.com> (raw)
In-Reply-To: <bbda6e8e-7169-b9c8-f408-e437cc384454@pgmasters.net>
References: <0c037137-9480-3afa-a4b7-1400a9879cd2@gmail.com>
<d4cbb3f6-80ac-ee8c-a0a0-78a54a7b27ae@pgmasters.net>
<a542dca5-5285-ad87-63c0-264a7d9839c0@gmail.com>
<bbda6e8e-7169-b9c8-f408-e437cc384454@pgmasters.net>
On 9/18/19 8:58 PM, David Steele wrote:
> On 9/18/19 9:40 PM, Ron wrote:
>> I'm concerned with one pgbackrest process stepping over another one and
>> the restore (or the "pg_ctl start" recovery phase) accidentally
>> corrupting the production database by writing WAL files to the original
>> cluster.
> This is not an issue unless you seriously game the system. When a
> cluster is promoted it selects a new timeline and all WAL will be
> archived to the repo on that new timeline. It's possible to promote a
> cluster without a timeline switch by tricking it but this is obviously a
> bad idea.
What's a timeline switchover?
> So, if you promote the new cluster and forget to disable archive_command
> there will be no conflict because the clusters will be generating WAL on
> separate timelines.
No cluster promotion even contemplated.
The point of the exercise would be to create an older copy of the cluster --
while the production cluster is still running, while production jobs are
still pumping data into the production database -- from before the time of
the data loss, and query it in an attempt to recover the records which were
deleted.
> In the case of a future failover a higher timeline will be selected so
> there still won't be a conflict.
>
> Unfortunately, that dead WAL from the rogue cluster will persist in the
> repo until an PostgreSQL upgrade because expire doesn't know when it can
> be removed since it has no context. We're not quite sure how to handle
> this but it seems a relatively minor issue, at least as far as
> consistency is concerned.
>
> If you do have a split-brain situation where two primaries are archiving
> on the same timeline then first-in wins. WAL from the losing primary
> will be rejected.
>
> Regards,
--
Angular momentum makes the world go 'round.
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: ronljohnsonjr@gmail.com
Subject: Re: pgbackrest - question about restoring cluster to a new cluster on same server
In-Reply-To: <cdf0f274-d94c-994c-6765-97a50fb9eae8@gmail.com>
References: <0c037137-9480-3afa-a4b7-1400a9879cd2@gmail.com> <d4cbb3f6-80ac-ee8c-a0a0-78a54a7b27ae@pgmasters.net> <a542dca5-5285-ad87-63c0-264a7d9839c0@gmail.com> <bbda6e8e-7169-b9c8-f408-e437cc384454@pgmasters.net> <cdf0f274-d94c-994c-6765-97a50fb9eae8@gmail.com>
* 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