From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: bufmgr: fewer calls to BufferDescriptorGetContentLock
Date: Wed, 08 Oct 2025 20:44:29 +0000
Message-ID: <E1v6b1R-000jbb-2Z@gemulon.postgresql.org> (raw)
bufmgr: fewer calls to BufferDescriptorGetContentLock
We're planning to merge buffer content locks into BufferDesc.state. To reduce
the size of that patch, centralize calls to BufferDescriptorGetContentLock().
The biggest part of the change is in assertions, by introducing
BufferIsLockedByMe[InMode]() (and removing BufferIsExclusiveLocked()). This
seems like an improvement even without aforementioned plans.
Additionally replace some direct calls to LWLockAcquire() with calls to
LockBuffer().
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3baae90013df58a8d124afa79df07075b8ebea09
Modified Files
--------------
src/backend/access/heap/visibilitymap.c | 3 +-
src/backend/access/transam/xloginsert.c | 3 +-
src/backend/storage/buffer/bufmgr.c | 70 ++++++++++++++++++++++++++-------
src/include/storage/bufmgr.h | 3 +-
4 files changed, 61 insertions(+), 18 deletions(-)
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-committers@postgresql.org
Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: bufmgr: fewer calls to BufferDescriptorGetContentLock
In-Reply-To: <E1v6b1R-000jbb-2Z@gemulon.postgresql.org>
* 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