Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()
Date: 2023-08-10 10:52:05
Message-ID: ZNTBVSMm4LU0/q4w@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-08-10 10:54:41 Re: [PATCH] Add loongarch native checksum implementation.
Previous Message Matthias van de Meent 2023-08-10 10:30:53 Re: [question] multil-column range partition prune