bufmgr/smgr: Don't cross segment boundaries in StartReadBuffers()
authorAndres Freund <andres@anarazel.de>
Tue, 8 Oct 2024 15:37:45 +0000 (11:37 -0400)
committerAndres Freund <andres@anarazel.de>
Tue, 8 Oct 2024 15:37:45 +0000 (11:37 -0400)
commit755a4c10d19dbe432a1860cced914c570ff3becc
tree7e803b760da946a32987cac5c2b0d21b5b9a9a32
parent488f826c729bd570c36df369fa8ac90c9a5a1b46
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@iki.fi>
Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/1f6b50a7-38ef-4d87-8246-786d39f46ab9@iki.fi
src/backend/storage/buffer/bufmgr.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/include/storage/md.h
src/include/storage/smgr.h