pgsql: Fix rare bug in read_stream.c's split IO handling.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix rare bug in read_stream.c's split IO handling.
Date: 2025-08-09 01:26:22
Message-ID: E1ukYLl-001TKE-1p@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix rare bug in read_stream.c's split IO handling.

The internal queue of buffers could become corrupted in a rare edge case
that failed to invalidate an entry, causing a stale buffer to be
"forwarded" to StartReadBuffers(). This is a simple fix for the
immediate problem.

A small API change might be able to remove this and related fragility
entirely, but that will have to wait a bit.

Defect in commit ed0b87ca.

Bug: 19006
Backpatch-through: 18
Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Discussion: https://postgr.es/m/19006-80fcaaf69000377e%40postgresql.org

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9110d81641696b95ea55f3a15dd0907ec0743529

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

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2025-08-10 20:06:38 pgsql: Remove, from stable branches, the new assertion of no pg_dump OI
Previous Message Thomas Munro 2025-08-09 01:26:14 pgsql: Fix rare bug in read_stream.c's split IO handling.