From e5bb679852dfc88dfc514b98c6d099ba7241fead Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Wed, 4 Feb 2026 18:26:16 +0200 Subject: [PATCH] Add get_pin_limit_hook --- src/backend/storage/buffer/bufmgr.c | 3 ++- src/include/storage/bufmgr.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 9aa56e5e4bc..4b84f3853d7 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -68,6 +68,7 @@ #include "utils/resowner.h" #include "utils/timestamp.h" +uint32 (*get_pin_limit_hook)(void); /* Note: these two macros only work on shared buffers, not local ones! */ #define BufHdrGetBlock(bufHdr) ((Block) (BufferBlocks + ((Size) (bufHdr)->buf_id) * BLCKSZ)) @@ -2526,7 +2527,7 @@ GetVictimBuffer(BufferAccessStrategy strategy, IOContext io_context) uint32 GetPinLimit(void) { - return MaxProportionalPins; + return get_pin_limit_hook ? get_pin_limit_hook() : MaxProportionalPins; } /* diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 804adf77a82..966b60b5cb0 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -334,6 +334,7 @@ extern int GetAccessStrategyPinLimit(BufferAccessStrategy strategy); extern void FreeAccessStrategy(BufferAccessStrategy strategy); +extern uint32 (*get_pin_limit_hook)(void); /* inline functions */