pgsql: Use unsigned integers for sinval message numbers. - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Use unsigned integers for sinval message numbers.
Date
Msg-id E1x9pQ6-000000017H8-3Knp@gemulon.postgresql.org
Whole thread
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Masahiko Sawada
Date:
Subject: pgsql: Add a range check on the sequence index from the publisher.
Next
From: Tom Lane
Date:
Subject: pgsql: Silence another "may be used uninitialized" compiler warning.