Re: Return pg_control from pg_backup_stop().

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: David Steele <david(at)pgbackrest(dot)org>, 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 09:48:10
Message-ID: 3e174819-8682-444b-905c-c2c40a709c8f@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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().

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-10-28 09:55:01 Re: [PATCH] Remove useless ORDER BY from scalar subqueries
Previous Message Andrei Lepikhov 2026-10-28 09:44:04 Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator