| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Re-read subscription state after lock in AlterSubscription |
| Date: | 2026-08-07 08:18:18 |
| Message-ID: | anWUyq2JUt4BwxRq@bdtpg |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Thu, Aug 06, 2026 at 03:50:09PM +0530, Shlok Kyal wrote:
> On Tue, 4 Aug 2026 at 11:25, Bertrand Drouvot
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> >
> > Hi,
> >
> > On Mon, Jul 06, 2026 at 02:53:39PM +0000, Bertrand Drouvot wrote:
> > > Hi,
> > >
> > > On Mon, Jul 06, 2026 at 03:07:24PM +0530, Amit Kapila wrote:
> > >
> > > DROP SUBSCRIPTION however has its own dedicated code path and does not go through
> > > get_object_address(): 0003 adds the retry loop for it. And if DROP already uses
> > > the retry loop then ALTER should probably use it too (also done in 0003 and 0004).
> >
> > Mandatory rebase attached.
> >
> Hi, I reviewed 0001 and 0002 patches.
Thanks!
> 0001 LGTM.
>
> Some comments for 0002 patch:
>
> 1. Here if 'tup' is invalid we are not checking the 'stmt->missing_ok' flag.
> Should we only throw an error if 'stmt->missing' is false?
> Otherwise 'DROP SUBSCRIPTION IF EXISTS' can throw an error like:
>
> postgres=# DROP SUBSCRIPTION IF EXISTS sub1;
> ERROR: subscription "sub1" does not exist
>
> 2. Should the function 'InvokeObjectDropHook' be called after the
> check in 'if (!HeapTupleIsValid(tup))'?
> If 'tup' is not valid, an error is thrown, and in this case, calling
> the function 'InvokeObjectDropHook' is unnecessary.
Yeah, both comments would be addressed by 0003, but 0002 should be correct on
its own, so fixed in the attached.
Also, while at it, I changed my mind about the post-lock owner recheck. I think
reporting "must be owner of subscription" is better than "tuple concurrently
updated", so 0001 and 0002 now perform this recheck and add some basic isolation
tests for it.
Those explicit rechecks become redundant once 0003 is applied (and 0004 does
the same for publications), but they make 0001 and 0002 behave better on their
own.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v6-0001-Re-read-subscription-state-after-lock-in-AlterSub.patch | text/x-diff | 7.4 KB |
| v6-0002-Re-read-subscription-state-after-lock-in-DropSubs.patch | text/x-diff | 9.0 KB |
| v6-0003-Add-invalidation-based-retry-loop-for-Alter-Drop-.patch | text/x-diff | 9.3 KB |
| v6-0004-Add-invalidation-based-retry-loop-for-AlterPublic.patch | text/x-diff | 9.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-08-07 08:23:15 | Re: WAL compression setting after PostgreSQL LZ4 default change |
| Previous Message | Michael Paquier | 2026-08-07 07:50:59 | Re: Fetch digests explicitly for cryptohash with OpenSSL 3.0 and later |