| From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
|---|---|
| To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(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> |
| Subject: | Re: [PATCH] Release replication slot on error in SQL-callable slot functions |
| Date: | 2026-08-31 22:10:08 |
| Message-ID: | CALj2ACXzuYPsh+1G2rJyghGBU-cQ+RXprJGgOuvO_xhGquiCPQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Mon, Aug 31, 2026 at 3:06 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Sun, Aug 30, 2026 at 9:40 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Sat, Aug 29, 2026 at 4:42 AM Bharath Rupireddy
> > <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > >
> > > In the replication slot subxact callback, on the abort path, we need
> > > to know whether the slot's creation failed. Ephemeral slots already
> > > handle that, but only for persistent logical slots. A temporary slot
> > > stays RS_TEMPORARY throughout. So there are a few ways to solve this:
> > >
> > > 1/ Also mark temporary slots as ephemeral initially and transition
> > > them to RS_TEMPORARY once creation succeeds. A quick check shows this
> > > needs changes in many places.
> > > 2/ Introduce a new state to represent a temporary slot still in
> > > creation (RS_TEMPORARY_EPHEMERAL or such).
> > > 3/ Use a boolean in the ReplicationSlot structure
> > > (is_create_in_progress or such), and in the subxact callback, when the
> > > slot is temporary and is_create_in_progress is set, drop just that
> > > temporary slot and leave the others alone.
> > >
> > > I prefer option 3,
> > >
> >
> > I would prefer option-1 as we have a similar pre-existing behaviour.
> >
> > to keep it simple without adding a new state, and
> > > because it is back-branch friendly.
> > >
> >
> > BTW, I was thinking this to be improved in HEAD-only as it is a more
> > impactful change.
>
> I was thinking the same. Even if we use option-1, an error could still
> happen when saving the slot to the disk (in ReplicationSlotSave()),
> leaving the slot behind while returning an error to the client. We
> might want to address that point too, and it should be only for HEAD.
I will start a separate thread for this soon. Thanks.
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mihail Nikalayeu | 2026-08-31 22:21:48 | Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master |
| Previous Message | Masahiko Sawada | 2026-08-31 22:06:06 | Re: [PATCH] Release replication slot on error in SQL-callable slot functions |