Re: [PATCH] Release replication slot on error in SQL-callable slot functions

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: [PATCH] Release replication slot on error in SQL-callable slot functions
Date: 2026-08-13 03:31:45
Message-ID: CAJpy0uBvj-hsKt+rKHoTdi+dPQdoDfJi0UwHYn1NkiiJMYNnVA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 13, 2026 at 7:01 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Mon, Aug 10, 2026 at 11:16 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > > I will drop both asserts and
> > > keep a short comment explaining why the slot is still held here. The
> > > existing AtEOSubXact_LargeObject() and AtEOSubXact_Files() don't check
> > > the passed-in mySubid for invalid either.
> > >
> > > Does the following work for you?
> > >
> > > /*
> > > * The aborting subxact is the one that acquired the slot, so the slot is
> > > * still held and must be released. acquiredInSubId is set only when a slot
> > > * is held and cleared when it is released, so a matching subxact id means
> > > * the slot is ours.
> > > */
> > > ReplicationSlotRelease();
> >
> > I am okay with this comment. No 'MyReplicationSlot-null' check and no assert.
>
> Thanks. Done so in the attached v12 patch. Please have a look.
>

Thanks. Looks good. I have no further comments.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-08-13 03:39:06 Re: Fix detection of truncated zstd-compressed backups
Previous Message wenhui qiu 2026-08-13 03:31:00 Re: WAL compression setting after PostgreSQL LZ4 default change