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: 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-03 05:27:55
Message-ID: CAJpy0uCjsy0sgELeJ1P-B2U_xk8nXSao0rYMLjPRHa81N2Cn2Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bharath, I could not find any issue in my basic testing, although I
would like to understand this part a bit better:

+ if (isCommit)
+ {
+ acquiredInSubId = parentSubid;
+ return;
+ }

How can we reach this block? In a non-error scenario, it seems that by
the time AtEOSubXact_ReplicationSlot() is invoked, the slot has
already been released, and we return earlier from 'if (acquiredInSubId
!= mySubid)' block. I could not find a case where:

a) the slot is acquired in the current subtransaction, b) the
subtransaction commits (isCommit == true), and c) the slot is still
held when AtEOSubXact_ReplicationSlot() is invoked.

Could you please explain what I am missing?

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-08-03 05:37:23 Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.
Previous Message Chao Li 2026-08-03 05:16:58 Re: tablecmds: fix bug where index rebuild loses replica identity on partitions