pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Steele <david@pgbackrest.org>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: shihao zhong <zhong950419@gmail.com>
Cc: Andy Pogrebnoi <andrew.pogrebnoi@percona.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Haibo Yan <tristan.yim@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: Shaun Thomas <shaun.thomas@pgedge.com>
Subject: Re: Return pg_control from pg_backup_stop().
Date: Tue, 15 Sep 2026 18:45:38 +0000 (UTC)
Message-ID: <d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org> (raw)
In-Reply-To: <A5E4F60C-C7C9-4FDE-8CD9-BC1E19A05674@yandex-team.ru>
References: <8b8aa673-fcef-4e14-a05d-0885283ef1b8@pgbackrest.org>
	<d21f3c7c-563c-49db-8983-faa73ed4369f@pgbackrest.org>
	<f74cab02-5ebb-439c-975b-29d019eed787@pgbackrest.org>
	<17DC1346-0CDE-4E39-B110-3D6FB0797AC6@gmail.com>
	<feb68313-3257-4d9d-8b69-6468e506a61a@pgbackrest.org>
	<7F7B289B-F94F-42C2-9E54-6A689C0D64BB@gmail.com>
	<aboDQSoywyKGGNCr@paquier.xyz>
	<1800c83c-264a-4183-9da5-ac78e25849a8@pgbackrest.org>
	<abov3-Kre8ntiL-S@paquier.xyz>
	<3b23e3b7-53d2-4784-b482-05cca3327acb@pgbackrest.org>
	<abphw4g2TwuPP0Cv@paquier.xyz>
	<df9e4c1f-4178-47fb-abdd-9829f7079b44@pgbackrest.org>
	<CA+aWR10d__mdN1pVbrCmmsSHG=0mur=fw9PBcL7k9bdoJ1qmKQ@mail.gmail.com>
	<CAPEjYe=QxL7Hn5CCcMpOm9use+s-ZhB2=NAOJPvDvy6DJaum=A@mail.gmail.com>
	<CAGRkXqSZUyXRq+Y9dOwfY52q1_KeR3_t2=o0x3djPTaS-jtY3A@mail.gmail.com>
	<c0d71fe5-c394-4387-8f13-9db44ea01988@pgbackrest.org>
	<A5E4F60C-C7C9-4FDE-8CD9-BC1E19A05674@yandex-team.ru>

Hi Andrey,

Thank you for having a look at the patch.

On 9/15/26 21:13, Andrey Borodin wrote:
> 
> On 15 Sep 2026, David Steele wrote:
>> I left this as is from v11. I think it's a pretty normal thing to do.
> 
> I found a case where the assertion itself does not hold:
> 
>> +Assert(crc_ok &&
>> +       memcmp(dataDisk, &controlData, sizeof(ControlFileData)) == 0);
> 
> During XLOG_CHECKPOINT_ONLINE replay, xlog_redo() updates
> ControlFile->checkPointCopy.nextXid under ControlFileLock without
> calling UpdateControlFile(). The in-memory copy can therefore differ
> from the on-disk file even while we hold the lock.
> 
> I can trigger this with the v13 patch on current master: pause a
> standby's base backup at basebackup-before-send-files, allocate an XID
> on the primary, run CHECKPOINT and wait for replay. Resuming the backup
> hits this assertion in backup_control_file().
> 
> IIUC, this mismatch does not mean that pg_control is torn. Perhaps we
> could drop the whole-struct equality assertion?

The mismatch is not an issue as far as I can see. I'll leave that 
determination up to Michael, though, since he added the assert.

> On the motivation, we have had many WAL-G support requests from users
> who removed backup_label to get a restored cluster to start. Here is
> one example [0], and a pgBackRest case prompted by the startup hint [1].
> I think protecting against this mistake is worthwhile.

I've seen this now more times than I can count, even from people that I 
would expect to know better. The hint from Postgres to delete 
backup_label certainly does not help the situation, though even with 
this patch we can't remove it completely. I'm hoping to at least deal 
with the common case.

> One concern about describing pg_resetwal as "the only way to clear it
> otherwise", even with the corruption warning: a WAL-G user actually
> removed backup_label and ran pg_resetwal, thinking this only meant
> giving up PITR [2]. Could we frame this as bypassing the protection,
> not as a way to clear the flag? It cannot replace the WAL replay needed
> to make a backup consistent.
Yeah, I have also seen pg_resetwal abused in various ways. I added that 
language based on feedback from Shihao and I think it should be 
documented but perhaps we need more cautionary language there. Let's see 
what people think.

Regards,
-David






view thread (64+ messages)  latest in thread

Message-ID: <d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org>
Permalink:  ../d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org/
Also on:    postgresql.org/message-id/d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org

 · 

reply

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-hackers@postgresql.org
  Cc: david@pgbackrest.org, x4mmm@yandex-team.ru, zhong950419@gmail.com, andrew.pogrebnoi@percona.com, michael@paquier.xyz, tristan.yim@gmail.com, hlinnaka@iki.fi, robertmhaas@gmail.com, andres@anarazel.de, masao.fujii@gmail.com, shaun.thomas@pgedge.com
  Subject: Re: Return pg_control from pg_backup_stop().
  In-Reply-To: <d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org>
  References: <8b8aa673-fcef-4e14-a05d-0885283ef1b8@pgbackrest.org> <d21f3c7c-563c-49db-8983-faa73ed4369f@pgbackrest.org> <f74cab02-5ebb-439c-975b-29d019eed787@pgbackrest.org> <17DC1346-0CDE-4E39-B110-3D6FB0797AC6@gmail.com> <feb68313-3257-4d9d-8b69-6468e506a61a@pgbackrest.org> <7F7B289B-F94F-42C2-9E54-6A689C0D64BB@gmail.com> <aboDQSoywyKGGNCr@paquier.xyz> <1800c83c-264a-4183-9da5-ac78e25849a8@pgbackrest.org> <abov3-Kre8ntiL-S@paquier.xyz> <3b23e3b7-53d2-4784-b482-05cca3327acb@pgbackrest.org> <abphw4g2TwuPP0Cv@paquier.xyz> <df9e4c1f-4178-47fb-abdd-9829f7079b44@pgbackrest.org> <CA+aWR10d__mdN1pVbrCmmsSHG=0mur=fw9PBcL7k9bdoJ1qmKQ@mail.gmail.com> <CAPEjYe=QxL7Hn5CCcMpOm9use+s-ZhB2=NAOJPvDvy6DJaum=A@mail.gmail.com> <CAGRkXqSZUyXRq+Y9dOwfY52q1_KeR3_t2=o0x3djPTaS-jtY3A@mail.gmail.com> <c0d71fe5-c394-4387-8f13-9db44ea01988@pgbackrest.org> <A5E4F60C-C7C9-4FDE-8CD9-BC1E19A05674@yandex-team.ru> <d9372aa0-0990-445a-b928-0902cd7088a9@pgbackrest.org>

* 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