Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "exclusion(at)gmail(dot)com" <exclusion(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database
Date: 2025-08-14 08:35:32
Message-ID: CAFiTN-tGARU3U-QKSXpU1VeCDiwJUVi-0S8-M8L6M18WJV+D5Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Aug 14, 2025 at 11:39 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Aug 13, 2025 at 3:00 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >
> > I have prepared back branch patches.
> >
>
> @@ -1802,11 +1802,7 @@ DropSubscription(DropSubscriptionStmt *stmt,
> bool isTopLevel)
> ...
> - /*
> - * Lock pg_subscription with AccessExclusiveLock to ensure that the
> - * launcher doesn't restart new worker during dropping the subscription
> - */
> - rel = table_open(SubscriptionRelationId, AccessExclusiveLock);
> + rel = table_open(SubscriptionRelationId, AccessShareLock);
>
> We need to acquire RowExclusiveLock here as we are deleting the
> subscription row during this operation. See docs [1] and
> AlterSubscription() code for reference.

Yeah that's right

Attached is a top-up patch to
> fix this for HEAD. Additionally, I have edited a few comments. If you
> agree with these changes then please prepare backbranch patches
> accordingly.

Yeah this looks fine to me. PFA patches for back branches.

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
v4-0001-Fix-DROP-SUBSCRIPTION-deadlock-with-new-database-V13.patch application/octet-stream 3.1 KB
v4-0001-Fix-DROP-SUBSCRIPTION-deadlock-with-new-database-master.patch application/octet-stream 3.1 KB
v4-0001-Fix-DROP-SUBSCRIPTION-deadlock-with-new-database-V16.patch application/octet-stream 3.1 KB
v4-0001-Fix-DROP-SUBSCRIPTION-deadlock-with-new-database-V14_15.patch application/octet-stream 3.1 KB
v4-0001-Fix-DROP-SUBSCRIPTION-deadlock-with-new-database-V17_18.patch application/octet-stream 3.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2025-08-14 08:48:27 Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database
Previous Message Amit Kapila 2025-08-14 06:09:04 Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database