pgsql: Fix checkpointer shared memory allocation

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix checkpointer shared memory allocation
Date: 2025-08-07 11:59:46
Message-ID: E1ujzHd-001Dkj-1n@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/1439188.1754506714%40sss.pgh.pa.us
Author: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Co-authored-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5cfbff48a4fdd1437ff06fcebdc2dade477ed4b8

Modified Files
--------------
src/backend/postmaster/checkpointer.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2025-08-07 12:00:34 pgsql: Fix checkpointer shared memory allocation
Previous Message Alexander Korotkov 2025-08-07 11:59:27 pgsql: Fix checkpointer shared memory allocation