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 <[email protected]>
Author: Thomas Munro <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
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(-)

Reply via email to