Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()
Date
Msg-id ZNTBVSMm4LU0/q4w@paquier.xyz
Whole thread Raw
In response to Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Fri, Jul 28, 2023 at 11:07:49AM +0530, Bharath Rupireddy wrote:
> Why to block multiple readers (if at all there exists any), with
> LWLockHeldByMeInMode(..., LW_EXCLUSIVE)? I think
> Assert(LWLockHeldByMe(AddinShmemInitLock)); suffices in
> GetNamedLWLockTranche.

I am not sure to follow this argument.  Why would it make sense for
anybody to use that in shared mode?  We document that the exclusive
mode is required because we retrieve the lock position in shmem that
an extension needs to know about when it initializes its own shmem
state, and that cannot be done safely without LW_EXCLUSIVE.  Any
extension I can find in https://codesearch.debian.net/ does that as
well.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: [question] multil-column range partition prune
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Add loongarch native checksum implementation.