Re: Timing issue in pg_basebackup

From: Jesper St John <jesper(at)stjohn(dot)se>
To: Jesper St John <admin(at)zonezero(dot)se>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Magnus Hagander <magnus(at)hagander(dot)net>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: Timing issue in pg_basebackup
Date: 2026-11-20 15:04:15
Message-ID: 4fdcbef083932d15d6d03c4fd9076e42@stjohn.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Here's a v4 patch that starts streaming immediately after slot creation
on v15+ versions, and as a fallback if needed - use the previous flow.
It is probably/most likely not done, but good to go for another round on
the list if anyone want to have a go at it.

I have not yet merged anything from previous thread, they seem to do the
same thing apart from the early streaming.

Many thanks to Magnus for off-list discussions and valuable feedback.

//Jesper

On 2026-11-17 12:35, Jesper St John wrote:
> Hi!
>
> Sorry, even though I’m pretty sure I searched for similar issues before
> posting, I missed it.
>
> Big thanks to Zsolt, Joao and Kirill for your input.
>
> I think combining work sounds like the reasonable thing to do. I’d be
> happy to help out in either thread.
>
> If any of you already know if one patch is preferable over the other,
> please do tell. If not I’ll review and try posting a follow-up.
>
> I’ve slowly started to implement a “start streaming directly after slot
> creation”-functionality and perhaps that could work with either patch.
>
> //Jesper
>
>
> Sent from my iPhone
>
>> On 16 Nov 2026, at 13:09, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>> Hi Magnus, all,
>>
>> Nick reported the same startpoint/slot race in August [0], tracked in
>> CF 7233 [1]. The client patch there opens the streaming connection and
>> creates its slot before BASE_BACKUP, but starts streaming only after
>> receiving the backup startpoint. Your proposal goes further than that.
>>
>> We also discussed cleanup of a newly created permanent slot when
>> BASE_BACKUP refuses to start. Zsolt's reports of slot invalidation and
>> idle timeout are relevant to that approach too.
>>
>> Could we combine the work and keep both threads linked from one CF
>> entry? This thread is currently tracked separately as CF 7613 [2].
>>
>> Thank you!
>>
>> Best regards, Andrey Borodin.
>>
>> [0]
>> https://www.postgresql.org/message-id/CALP_NYTTvKzJ+chEUXLsyGaM+HYcP1WwGwXkZEnDfv-7FbPowQ@mail.gmail.com
>> [1] https://commitfest.postgresql.org/patch/7233/
>> [2] https://commitfest.postgresql.org/patch/7613/

Attachment Content-Type Size
v4-0001-pg_basebackup-Create-and-start-WAL-streaming-slot.patch text/x-diff 23.0 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-11-20 15:25:01 Re: BUG #19927: PostgreSQL 16: SQL dump adds experimental/incompatible options like \restrict
Previous Message ZizhuanLiu X-MAN 2026-11-20 14:22:33 Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs