Re: Timing issue in pg_basebackup

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Jesper St John <jesper(at)stjohn(dot)se>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Timing issue in pg_basebackup
Date: 2026-10-22 05:44:24
Message-ID: CALdSSPg2hY=8SLZRk-o22oUAd=af7oNEXRJf8coTf-hjOtRg-A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

--
Best regards,
Kirill Reshke

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2026-10-22 07:06:51 Re: START_REPLICATION silently truncates an overlong LSN component
Previous Message PG Bug reporting form 2026-10-22 05:42:51 BUG #19788: Chinese translation uses incorrect term for “transaction” in “no transaction is in progress”