agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.
Date: Thu, 03 Sep 2026 20:16:27 +0000
Message-ID: <E1x2DrG-00000003MDa-1BLF@gemulon.postgresql.org> (raw)

Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.

Presently, this field stores the buffer's index, i.e., the Buffer
minus one, and it uses -1 to mean "not waiting."  The callers
subtract one before storing the value and add it back after reading
it.  This commit changes the field to store the Buffer itself and
to use InvalidBuffer (0) as the sentinel, which gets rid of that
arithmetic.

This is preparatory work for a follow-up commit that will convert
the variable to an unsigned atomic, for which a negative sentinel
makes little sense.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/alAJeRRzehDjLaF1%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8ca9cfb77838b3a17b7c9b5ef26cb2a26b5e1bb2

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 16 ++++++++--------
src/backend/storage/lmgr/proc.c     | 20 ++++++++++----------
src/include/storage/proc.h          |  9 +++++----
3 files changed, 23 insertions(+), 22 deletions(-)



Message-ID: <E1x2DrG-00000003MDa-1BLF@gemulon.postgresql.org>
Permalink:  ../E1x2DrG-00000003MDa-1BLF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x2DrG-00000003MDa-1BLF@gemulon.postgresql.org

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-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.
  In-Reply-To: <E1x2DrG-00000003MDa-1BLF@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox