From 5ee75e32fa734e8ae85ff096f1523be8e16e1b8d Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 24 Feb 2025 05:39:27 -0500 Subject: Add static asserts for MAX_BACKENDS limiting factors So far the various dependencies were documented in the comment above MAX_BACKENDS, but not checked. Discussion: https://postgr.es/m/CA+COZaBO_s3LfALq=b+HcBHFSOEGiApVjrRacCe4VP9m7CJsNQ@mail.gmail.com --- src/backend/storage/lmgr/deadlock.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/backend/storage') diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c index dc6923f8132..c4bfaaa67ac 100644 --- a/src/backend/storage/lmgr/deadlock.c +++ b/src/backend/storage/lmgr/deadlock.c @@ -30,6 +30,7 @@ #include "pgstat.h" #include "storage/lmgr.h" #include "storage/proc.h" +#include "storage/procnumber.h" #include "utils/memutils.h" @@ -191,6 +192,8 @@ InitDeadLockChecking(void) * last MaxBackends entries in possibleConstraints[] are reserved as * output workspace for FindLockCycle. */ + StaticAssertStmt(MAX_BACKENDS_BITS <= (32 - 3), + "MAX_BACKENDS_BITS too big for * 4"); maxPossibleConstraints = MaxBackends * 4; possibleConstraints = (EDGE *) palloc(maxPossibleConstraints * sizeof(EDGE)); -- cgit v1.2.3