pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Rahila Syed <rahilasyed90@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Improve LWLock tranche name visibility across backends
Date: Mon, 25 Aug 2025 19:14:40 -0500
Message-ID: <aKz8cHo2oBr-6uq5@nathan> (raw)
In-Reply-To: <CAA5RZ0vWh2uxG99iUb3P4nsoDLk0x7Yuai83AbbGs3YZvJM8QQ@mail.gmail.com>
References: <876523.1755635201@sss.pgh.pa.us>
	<CAA5RZ0sbo-HAOrTGVoqP3giXKDV_LXL0UGaYs8mfjcS33mn3FQ@mail.gmail.com>
	<aKTlu7mHhx4owx6r@nathan>
	<CAA5RZ0tg0-O3KVrP9UrZWm18OECxK87WNJo=cZy=Gevc+Ui5oA@mail.gmail.com>
	<aKTqiofwo1Eif_3w@nathan>
	<CAA5RZ0tKoQeTuRsFmUjPAOEXBiyEGyePsqCAy-_oX4eFHSCmHw@mail.gmail.com>
	<aKzP-H-KzPay-ByM@nathan>
	<CAA5RZ0vh7jrGDwJgkKtw-LR5fBH-tRNpGJnPivdKedtqJ7HGCQ@mail.gmail.com>
	<aKzZV8Acib6pFesE@nathan>
	<CAA5RZ0vWh2uxG99iUb3P4nsoDLk0x7Yuai83AbbGs3YZvJM8QQ@mail.gmail.com>

On Mon, Aug 25, 2025 at 04:59:41PM -0500, Sami Imseih wrote:
> hmm, can we really avoid a shared lock when reading from shared memory?
> considering access for both reads and writes can be concurrent to shared
> memory. We are also taking an exclusive lock when writing a new tranche.

We probably want to hold a lock while we 1) increment LWLockCounter and
copy a new tranche name to memory and 2) while we copy the current value of
LWLockCounter to our backend-local variable.  Otherwise, AFAICT we don't
need one.  We could probably use ShmemLock for this.

-- 
nathan





view thread (107+ messages)  latest in thread

Message-ID: <aKz8cHo2oBr-6uq5@nathan>
Permalink:  ../aKz8cHo2oBr-6uq5@nathan/
Also on:    postgresql.org/message-id/aKz8cHo2oBr-6uq5@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, samimseih@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, bertranddrouvot.pg@gmail.com, rahilasyed90@gmail.com
  Subject: Re: Improve LWLock tranche name visibility across backends
  In-Reply-To: <aKz8cHo2oBr-6uq5@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox