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: Use unsigned integers for sinval message numbers.
Date: Thu, 24 Sep 2026 19:47:50 +0000
Message-ID: <E1x9pQ6-000000017H8-3Knp@gemulon.postgresql.org> (raw)

Use unsigned integers for sinval message numbers.

Currently, the message numbers in sinvaladt.c are ints, but they
are never negative, and the code already takes pains to keep them
from overflowing.  This commit changes them to uint32.  The only
wrinkle is that SICleanupQueue() computes two thresholds by
subtracting from maxMsgNum, and those could previously go negative.
They are now clamped at zero, which disables the corresponding
checks just as a negative threshold did.

This is preparatory work for a follow-up commit that will convert
maxMsgNum to an unsigned atomic variable.

Author: Yura Sokolov <y.sokolov@postgrespro.ru>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/30aa0030-f694-44ef-a19d-6ef7ddb69374%40postgrespro.ru
Discussion: https://postgr.es/m/alAJeRRzehDjLaF1%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/25217d91b1a266a4176db8327c21c508de81c72b

Modified Files
--------------
src/backend/storage/ipc/sinvaladt.c | 38 +++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)



Message-ID: <E1x9pQ6-000000017H8-3Knp@gemulon.postgresql.org>
Permalink:  ../E1x9pQ6-000000017H8-3Knp@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x9pQ6-000000017H8-3Knp@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: Use unsigned integers for sinval message numbers.
  In-Reply-To: <E1x9pQ6-000000017H8-3Knp@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