Re: 024_add_drop_pub.pl might fail due to deadlock

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 024_add_drop_pub.pl might fail due to deadlock
Date: 2025-07-31 09:37:24
Message-ID: CAA4eK1J0qFm6QRc4wcbq19P4PcSWnB=i+f6n1m8njweoD87xaQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 31, 2025 at 2:37 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> How about we change the below:
> +#ifdef USE_ASSERT_CHECKING
> + LOCKTAG tag;
> +#endif
> +
> + Assert(CheckRelationOidLockedByMe(SubscriptionRelRelationId,
> +
> RowExclusiveLock, true));
> +
> + rel = table_open(SubscriptionRelRelationId, NoLock);
> +#ifdef USE_ASSERT_CHECKING
> + SET_LOCKTAG_OBJECT(tag, InvalidOid,
> SubscriptionRelationId, subid, 0);
> + Assert(LockHeldByMe(&tag, AccessShareLock, true));
> +#endif
>
> to:
> #ifdef USE_ASSERT_CHECKING
> LOCKTAG tag;
> Assert(CheckRelationOidLockedByMe(SubscriptionRelRelationId,
> RowExclusiveLock, true));
> SET_LOCKTAG_OBJECT(tag, InvalidOid, SubscriptionRelationId, subid, 0);
> Assert(LockHeldByMe(&tag, AccessShareLock, true));
> #endif
>
> rel = table_open(SubscriptionRelRelationId, NoLock);
> }
>

Your suggested change looks better to me.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2025-07-31 09:40:57 Re: Improve pg_sync_replication_slots() to wait for primary to advance
Previous Message Amit Kapila 2025-07-31 09:29:25 Re: Conflict detection for update_deleted in logical replication