Re: Re-read subscription state after lock in AlterSubscription

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(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>, "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-07-06 05:01:00
Message-ID: aks2jHJeKW8Ay2N5@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Kuroda-san,

On Mon, Jul 06, 2026 at 02:43:20AM +0000, Hayato Kuroda (Fujitsu) wrote:
> Dear Bertrand,
>
> Thanks for updating the patch. I found one issue:
>
> ```
> /* DROP hook for the subscription being removed */
> InvokeObjectDropHook(SubscriptionRelationId, subid, 0);
>
> ```
>
> I think the reporting should be after the loop, otherwise the wrong subid can be
> reported.

Yeah, and I think this is an existing behavior not related to the patch. Currently,
InvokeObjectDropHook() is called before we lock the subscription. I think that
makes more sense to do it after the lock is acquired, so this is now changed in
0002.

Also addressing Dilip's comment in the attached.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v4-0001-Re-read-subscription-state-after-lock-in-AlterSub.patch text/x-diff 3.9 KB
v4-0002-Re-read-subscription-state-after-lock-in-DropSubs.patch text/x-diff 3.3 KB
v4-0003-Add-invalidation-based-retry-loop-for-Alter-Drop-.patch text/x-diff 8.7 KB
v4-0004-Add-invalidation-based-retry-loop-for-AlterPublic.patch text/x-diff 5.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-07-06 05:12:24 Re: [PATCH] Preserve replication origin OIDs in pg_upgrade
Previous Message Amit Kapila 2026-07-06 04:54:26 Re: Re-read subscription state after lock in AlterSubscription