agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.
@ 2026-09-03 20:16  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-09-03 20:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Convert PROC_HDR->startupBufferPinWaitBuf to an atomic variable.
@ 2026-09-22 18:22  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-09-22 18:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Convert PROC_HDR->startupBufferPinWaitBuf to an atomic variable.

Currently, this variable is a Buffer that is accessed via a
volatile pointer.  By converting it to an atomic variable, we can
remove the volatile qualifiers.  No barriers are needed because the
value is published before the backends that read it are signaled.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cb4a03db9ed7606da1c36e4214a6c5fd6437a26c

Modified Files
--------------
src/backend/storage/lmgr/proc.c | 12 +++---------
src/include/storage/proc.h      |  2 +-
2 files changed, 4 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-22 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 20:16 pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer. Nathan Bossart <nathan@postgresql.org>
2026-09-22 18:22 pgsql: Convert PROC_HDR->startupBufferPinWaitBuf to an atomic variable. Nathan Bossart <nathan@postgresql.org>

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