aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2025-03-14 15:10:43 +1300
committerThomas Munro <tmunro@postgresql.org>2025-03-14 17:13:09 +1300
commit01261fb07888642efa98ba8d4117654bfd2a413d (patch)
treea7fb87d483db2ba42f2f2226f3283982fc6d48d8 /src/include/storage
parent7c99dc587a010a0c40d72a0e435111ca7a371c02 (diff)
downloadpostgresql-01261fb07888642efa98ba8d4117654bfd2a413d.tar.gz
postgresql-01261fb07888642efa98ba8d4117654bfd2a413d.zip
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
Diffstat (limited to 'src/include/storage')
-rw-r--r--src/include/storage/bufmgr.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index b204e4731c1..79a89f87fcc 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -290,6 +290,10 @@ extern bool HoldingBufferPinThatDelaysRecovery(void);
extern bool BgBufferSync(struct WritebackContext *wb_context);
+extern uint32 GetPinLimit(void);
+extern uint32 GetLocalPinLimit(void);
+extern uint32 GetAdditionalPinLimit(void);
+extern uint32 GetAdditionalLocalPinLimit(void);
extern void LimitAdditionalPins(uint32 *additional_pins);
extern void LimitAdditionalLocalPins(uint32 *additional_pins);