pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.

Поиск
Список
Период
Сортировка
Искать

pgsql: Convert PROC_HDR->startupBufferPinWaitBufId to a Buffer.

От:
Nathan Bossart <nathan@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 
Reviewed-by: Andres Freund 
Reviewed-by: Zsolt Parragi 
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(-)

FAQ