Re: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING
Date
Msg-id CALj2ACVYytdSd0TD2khJse9XVXO4PCfK8WZ=Ha=vF-cR-uYUbQ@mail.gmail.com
Whole thread Raw
In response to Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING
List pgsql-hackers
Hi,

On Mon, Jul 1, 2024 at 12:12 PM Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
>
> Hi hackers,
>
> While working on a rebase for [1] due to 0cecc908e97, I noticed that
> CheckRelationLockedByMe() and CheckRelationOidLockedByMe() are used only in
> assertions.
>
> I think it would make sense to declare / define those functions only for
> assert enabled build: please find attached a tiny patch doing so.
>
> Thoughts?

If turning the CheckRelationXXXLocked() compile for non-assert builds,
why not do the same for LWLockHeldByMe, LWLockAnyHeldByMe and
LWLockHeldByMeInMode that are debug-only and being used in asserts?
While it might reduce the compiled binary size a bit for release
builds, we may have to be cautious about external or out of core
modules using them.

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



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING
Next
From: Peter Eisentraut
Date:
Subject: Re: Virtual generated columns