| From: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
|---|---|
| To: | David Steele <david(at)pgbackrest(dot)org> |
| Cc: | shihao zhong <zhong950419(at)gmail(dot)com>, Andy Pogrebnoi <andrew(dot)pogrebnoi(at)percona(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Shaun Thomas <shaun(dot)thomas(at)pgedge(dot)com> |
| Subject: | Re: Return pg_control from pg_backup_stop(). |
| Date: | 2026-09-15 18:13:26 |
| Message-ID: | A5E4F60C-C7C9-4FDE-8CD9-BC1E19A05674@yandex-team.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi David,
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?
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.
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.
Thank you!
Best regards, Andrey Borodin.
[0] https://github.com/wal-g/wal-g/issues/115
[1] https://github.com/pgbackrest/pgbackrest/issues/839#issuecomment-532253964
[2] https://github.com/wal-g/wal-g/issues/1279#issuecomment-1144554054
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-09-15 18:29:02 | Re: Possible race condition in pg_basebackup |
| Previous Message | Greg Sabino Mullane | 2026-09-15 17:57:04 | Re: POC: Carefully exposing information without authentication |