Re: Improve LWLock tranche name visibility across backends - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Improve LWLock tranche name visibility across backends
Date
Msg-id aKz8cHo2oBr-6uq5@nathan
Whole thread Raw
In response to Re: Improve LWLock tranche name visibility across backends  (Sami Imseih <samimseih@gmail.com>)
Responses Re: Improve LWLock tranche name visibility across backends
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Use LW_SHARED in WakeupWalSummarizer() for WALSummarizerLock lock
Next
From: Sami Imseih
Date:
Subject: Re: Per backend relation statistics tracking