pgsql: Make max_pinned_buffers be > 0, don't just Assert that it is.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make max_pinned_buffers be > 0, don't just Assert that it is.
Date: 2026-07-15 17:24:09
Message-ID: E1wk3L6-000KFf-0r@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make max_pinned_buffers be > 0, don't just Assert that it is.

It was possible to trigger read_stream_begin_relation's
assertion that it calculated nonzero max_pinned_buffers,
in scenarios with unreasonably small numbers of buffers.
There seems to be no visible problem in non-Assert builds.

The bug occurs only in v17 (the first branch containing
this logic), because commit 92fc6856c replaced that Assert
with a runtime clamp. I won't risk back-patching that entire
commit, but let's copy just this minimal fix.

Bug: #19551
Reported-by: Roman Zharkov <r(dot)zharkov(at)postgrespro(dot)ru>
Author: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19551-d4a55b8fe81db4f2@postgresql.org
Backpatch-through: 17 only

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3d3b8872814362e061802703bb5d92fe050fc602

Modified Files
--------------
src/backend/storage/aio/read_stream.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-07-15 18:02:32 pgsql: Add additional sanity checks when reading a blkreftable.
Previous Message Fujii Masao 2026-07-15 12:26:18 pgsql: Fix argument names in pg_clear_attribute_stats() errors