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 <[email protected]> Reviewed-by: Andres Freund <[email protected]> Reviewed-by: Zsolt Parragi <[email protected]> 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(-)
