Allow BufferAccessStrategy to limit pin count.
authorThomas Munro <tmunro@postgresql.org>
Sat, 6 Apr 2024 09:58:48 +0000 (22:58 +1300)
committerThomas Munro <tmunro@postgresql.org>
Sat, 6 Apr 2024 10:11:45 +0000 (23:11 +1300)
commit3bd8439ed628c7e9ac250b1a042d9044303c37e7
tree5c873d096cc74591d1d1d21598af69c66918353c
parentf956ecd0353b2960f8322b2211142113fe2b6f67
Allow BufferAccessStrategy to limit pin count.

While pinning extra buffers to look ahead, users of strategies are in
danger of using too many buffers.  For some strategies, that means
"escaping" from the ring, and in others it means forcing dirty data to
disk very frequently with associated WAL flushing.  Since external code
has no insight into any of that, allow individual strategy types to
expose a clamp that should be applied when deciding how many buffers to
pin at once.

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CAAKRu_aJXnqsyZt6HwFLnxYEBgE17oypkxbKbT1t1geE_wvH2Q%40mail.gmail.com
src/backend/storage/aio/read_stream.c
src/backend/storage/buffer/freelist.c
src/include/storage/bufmgr.h