diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 66fb2e4231..9fe6855945 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -73,11 +73,11 @@ static LWLockTranche MainLWLockTranche; /* * We use this structure to keep track of locked LWLocks for release - * during error recovery. The maximum size could be determined at runtime - * if necessary, but it seems unlikely that more than a few locks could - * ever be held simultaneously. + * during error recovery. Normally, only a few will be held at once, but + * occasionally the number can be much higher; for example, the pg_buffercache + * extension locks all buffer partitions simultaneously. */ -#define MAX_SIMUL_LWLOCKS 100 +#define MAX_SIMUL_LWLOCKS 200 static int num_held_lwlocks = 0; static LWLock *held_lwlocks[MAX_SIMUL_LWLOCKS]; diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index 90ae7d443d..02c8f1aa8c 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -136,7 +136,7 @@ extern PGDLLIMPORT LWLockPadded *MainLWLockArray; */ /* Number of partitions of the shared buffer mapping hashtable */ -#define NUM_BUFFER_PARTITIONS 16 +#define NUM_BUFFER_PARTITIONS 128 /* Number of partitions the shared lock tables are divided into */ #define LOG2_NUM_LOCK_PARTITIONS 4