pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.
Date: 2026-09-03 20:16:27
Message-ID: E1x2DrG-00000003MDa-1BLF@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)eisentraut(dot)org>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2026-09-03 20:27:30 pgsql: Add index scan pgstat test coverage.
Previous Message Peter Geoghegan 2026-09-03 19:36:43 pgsql: Move visibility map memory ordering comments.