Re: Timing issue in pg_basebackup

From: Jesper St John <jesper(at)stjohn(dot)se>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Timing issue in pg_basebackup
Date: 2026-11-09 13:19:29
Message-ID: 80143a07e6732576c9f815a3058fa31d@stjohn.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Added this patch to the CF app.

Made it into one and rebased it.

//Jesper

On 2026-10-22 07:44, Kirill Reshke wrote:
> On Wed, 21 Oct 2026 at 22:16, Jesper St John <jesper(at)stjohn(dot)se> wrote:
>>
>> On 2026-10-20 23:11, Kirill Reshke wrote:
>
>> >
>> >> I've included a patch that moves the replication slot handing to run
>> >> before the backup part as a separate function.
>> >>
>> >> Some possible caveats already:
>> >> * Since moving the slot creation, we might run in to trouble if for
>> >> example, --checkpoint=spread is used since the slot is open for
>> >> longer.
>> >> * If any error arises in the backup part, now there will be a
>> >> lingering
>> >> slot when previously no slot was created.
>> >
>> > lingering slots looks like a real regression here. can we remove them
>> > when basebackup client disconnects?
>>
>> A lingering slot could also happen today - only with this patch
>> there's
>> a higher risk of it happening.
>
> Higher risk of lingering slots is also a regression. But looks like
> this risk is anyway close to zero.
>
>> Would some cleanup code in a function and use it with atexit() work?
>
> Something like this should do, can be made a separate patch thought
>
>> >
>> > NIT: comment in PrepareLogStreamer loses its meaning after code motion:
>> >
>> > + /* Get a second connection */
>> > + bgconn = GetConnection();
>> >
>>
>> I've moved the code to its own function - the comment were there
>> already.
>>
>
> Yep, the point is It looks very out-of-context here. Like, the first
> line of the function says we're taking a second connection. Second to
> what (to basebackup)? Maybe rephrase here as 'Get a wal-serving
> connection' or something.

Attachment Content-Type Size
v3-0001-pg_basebackup-Create-the-WAL-streaming-slot-befor.patch text/x-diff 13.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bertrand Drouvot 2026-11-09 14:47:17 Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
Previous Message Atisss hh 2026-11-09 13:01:30 Re: BUG #19856: GiST index on tsquery misses empty tsquery rows for <@