Re: Possible race condition in pg_basebackup

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
Cc: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, nick ivanov <nick(at)thebeaches(dot)online>
Subject: Re: Possible race condition in pg_basebackup
Date: 2026-11-13 06:39:02
Message-ID: 1759BE1B-FB66-4911-84CA-D15E2C5970E9@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On 17 Oct 2026, Raja Sai Pranav wrote:
> Would it make sense to drop the slot when BASE_BACKUP fails, if this
> run created it?

For a backpatch, I'd preserve the old behavior on a refused start: drop
the permanent slot if this run successfully created it and BASE_BACKUP
is rejected before returning the startpoint. The ownership flag should
only be set after successful creation, so a failed --create-slot cannot
cause an existing slot to be dropped. I'd keep later backup failures
unchanged.

Our test drops the permanent slot itself after success, so it does not
cover this. The bogus-checksum case should check both the specific error
and absence of the new slot. An existing slot should survive both a
rejected backup and a failed --create-slot. Cleanup failure should not
replace the original backup error.

Nick, could we put the early-error cleanup and its tests in a separate
patch in the same backpatch series? That would keep the early-slot
change focused.

Thank you!

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-11-13 06:46:59 Re: SIGFPE handling
Previous Message Nisha Moond 2026-11-13 06:35:20 Re: Crashes on a partition whose concurrent detach never finished