pgsql: Fix shared memory size of template code for custom fixed-sized p

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix shared memory size of template code for custom fixed-sized p
Date: 2026-04-06 23:24:55
Message-ID: E1w9tJO-003Iyl-2x@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix shared memory size of template code for custom fixed-sized pgstats

On HEAD, the template code for custom fixed-sized pgstats is in the test
module test_custom_stats. On REL_18_STABLE, this code lives in the test
module injection_points.

Both cases were underestimating the size of the shared memory area
required for the storage of the stats data, using a single entry rather
than the whole area. This underestimation meant that there was no
memory allocated for the LWLock required for the stats, and even more.
This problem would be also misleading for extension developers looking
at this code.

This issue has been noticed while digging into a different bug reported
by Heikki Linnakangas, showing that the underestimation was causing
failures in the TAP tests of the test modules for 32-bit builds. The
other issue reported, related to the memory allocation of custom
fixed-sized pgstats, will be fixed in a follow-up commit.

Discussion: https://postgr.es/m/adMk_lWbnz3HDOA8@paquier.xyz
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/98979578055ffba3bd520adcec00881f72fc2861

Modified Files
--------------
src/test/modules/test_custom_stats/test_custom_fixed_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2026-04-07 01:48:40 pgsql: Fix deferred FK check batching introduced by commit b7b27eb41a5
Previous Message Melanie Plageman 2026-04-06 23:14:53 pgsql: Allocate separate DSM chunk for parallel Index[Only]Scan instrum