pgsql: bufmgr/smgr: Don't cross segment boundaries in StartReadBuffers(

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: bufmgr/smgr: Don't cross segment boundaries in StartReadBuffers(
Date: 2024-10-08 16:57:17
Message-ID: E1syDWP-002jSB-T2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

bufmgr/smgr: Don't cross segment boundaries in StartReadBuffers()

With real AIO it doesn't make sense to cross segment boundaries with one
IO. Add smgrmaxcombine() to allow upper layers to query which buffers can be
merged.

We could continue to cross segment boundaries when not using AIO, but it
doesn't really make sense, because md.c will never be able to perform the read
across the segment boundary in one system call. Which means we'll mark more
buffers as undergoing IO than really makes sense - if another backend desires
to read the same blocks, it'll be blocked longer than necessary. So it seems
better to just never cross the boundary.

Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/1f6b50a7-38ef-4d87-8246-786d39f46ab9@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/755a4c10d19dbe432a1860cced914c570ff3becc

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 18 ++++++++++++++++++
src/backend/storage/smgr/md.c | 21 +++++++++++++++++++++
src/backend/storage/smgr/smgr.c | 22 ++++++++++++++++++++++
src/include/storage/md.h | 2 ++
src/include/storage/smgr.h | 2 ++
5 files changed, 65 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-10-08 17:52:19 pgsql: Add min and max aggregates for bytea type.
Previous Message Tom Lane 2024-10-08 15:15:22 pgsql: Silence buildfarm warning chatter from bd1276a3c.