Re: Return pg_control from pg_backup_stop().

From: David Steele <david(at)pgbackrest(dot)org>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, solai v <solai(dot)cdac(at)gmail(dot)com>
Subject: Re: Return pg_control from pg_backup_stop().
Date: 2026-10-28 10:55:11
Message-ID: 3bddbc41-b274-47b6-abd4-d11918906b32@pgbackrest.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/28/26 10:48, Heikki Linnakangas wrote:
> On 26/10/2026 13:42, David Steele wrote:
>> On 10/23/26 18:17, Heikki Linnakangas wrote:
>>> On 23/10/2026 15:42, David Steele wrote:
>>> Umm, not new with his patch, but why do we still have that hint to
>>> remove backup_label? Is that ever the right thing to do? Why didn't
>>> we remove that hint when exclusive-mode backups were removed?
>>
>> Unfortunately I believe there is still a use case for this hint. When
>> making a backup, e.g. via snapshot, it is still easier to write the
>> backup_label into PGDATA, make the snapshot, then remove it. If the
>> cluster crashes before the removal then the answer is to remove the
>> backup label, just as it was if exclusive backup crashed.
>>
>> I'm not excited about the above use case but not sure we can discount
>> it entirely.
>
> If you take an atomic filesystem-level snapshot, restoring it is
> equivalent to crash recovery, so you don't need a backup_label to
> restore it to a consistent state. There's no need for pg_start_backup()
> or a backup_label in that case. Admittedly, a non-atomic snapshot is a
> different story.

True, but I recommend *always* using the documented backup procedure,
especially if PITR will be used on restore.

> But I don't see how you could do that anyway. The backup_label is
> returned by pg_stop_backup(). If the sequence is:
>
> 1. pg_start_backup()
> 2. take filesystem snapshot
> 3. pg_stop_backup()
>
> there's no way to include the backup_label in the snapshot, because you
> don't have it until you call pg_stop_backup().
Oops, yeah, that was an old pattern what was still usable up until PG14
but should no longer be possible.

I searched the thread where we removed exclusive backup and I can't see
any reason why we would have kept it, so it was probably an oversight.

Once Michael and I have resolved the build farm issue with 01 I'll
rebase and make the removal a small patch before adding the pgcontrol
flag -- unless you would prefer a separate thread.

Regards,
-David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-10-28 10:56:50 Re: Return pg_control from pg_backup_stop().
Previous Message Amit Langote 2026-10-28 10:45:53 Re: SQL/JSON DEFAULT ON ERROR/ON EMPTY evaluation fail should rethrow error unconditionally