Fix checkpointer shared memory allocation

Alexander Korotkov <akorotkov@postgresql.org>

Commit: 5cfbff48a4fdd1437ff06fcebdc2dade477ed4b8
Author: Alexander Korotkov <akorotkov@postgresql.org>
Date: 2025-08-07T11:31:18Z
Releases: 18.0
Fix checkpointer shared memory allocation

Use Min(NBuffers, MAX_CHECKPOINT_REQUESTS) instead of NBuffers in
CheckpointerShmemSize() to match the actual array size limit set in
CheckpointerShmemInit().  This prevents wasting shared memory when
NBuffers > MAX_CHECKPOINT_REQUESTS.  Also, fix the comment.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1439188.1754506714%40sss.pgh.pa.us
Author: Xuneng Zhou <xunengzhou@gmail.com>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>

Files

PathChange+/−
src/backend/postmaster/checkpointer.c modified +6 −3

Discussion