pgsql: Improve buffer manager API for backend pin limits. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Improve buffer manager API for backend pin limits.
Date
Msg-id E1tswTW-002Ngq-37@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve buffer manager API for backend pin limits.

Previously the support functions assumed that the caller needed one pin
to make progress, and could optionally use some more, allowing enough
for every connection to do the same.  Add a couple more functions for
callers that want to know:

* what the maximum possible number could be, irrespective of currently
  held pins, for space planning purposes

* how many additional pins they could acquire right now, without the
  special case allowing one pin, for callers that already hold pins and
  could already make progress even if no extra pins are available

The pin limit logic began in commit 31966b15.  This refactoring is
better suited to read_stream.c, which will be adjusted to respect the
remaining limit as it changes over time in a follow-up commit.  It also
computes MaxProportionalPins up front, to avoid performing divisions
whenever a caller needs to check the balance.

Reviewed-by: Andres Freund <andres@anarazel.de> (earlier versions)
Discussion: https://postgr.es/m/CA%2BhUKGK_%3D4CVmMHvsHjOVrK6t4F%3DLBpFzsrr3R%2BaJYN8kcTfWg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/01261fb07888642efa98ba8d4117654bfd2a413d

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c   | 80 ++++++++++++++++++++++++-----------
src/backend/storage/buffer/localbuf.c | 16 +++++++
src/include/storage/bufmgr.h          |  4 ++
3 files changed, 75 insertions(+), 25 deletions(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Fix ALTER SUBSCRIPTION ... SET PUBLICATION ... command.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Swap order of extern/static and pg_nodiscard