diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index a4aecd1fbc34..1d427a68cec1 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -508,6 +508,7 @@ InitializeLWLocks(void) strcpy(name, request->tranche_name); tranche->trancheId = LWLockNewTrancheId(); tranche->trancheName = name; + tranche->num_lwlocks = request->num_lwlocks; for (j = 0; j < request->num_lwlocks; j++, lock++) LWLockInitialize(&lock->lock, tranche->trancheId); @@ -548,11 +549,11 @@ GetNamedLWLockTranche(const char *tranche_name) lock_pos = NUM_FIXED_LWLOCKS; for (i = 0; i < NamedLWLockTrancheRequests; i++) { - if (strcmp(NamedLWLockTrancheRequestArray[i].tranche_name, + if (strcmp(NamedLWLockTrancheArray[i].trancheName, tranche_name) == 0) return &MainLWLockArray[lock_pos]; - lock_pos += NamedLWLockTrancheRequestArray[i].num_lwlocks; + lock_pos += NamedLWLockTrancheArray[i].num_lwlocks; } elog(ERROR, "requested tranche is not registered"); diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index f9cf57f8d266..0f3d17af1e24 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -78,6 +78,7 @@ typedef struct NamedLWLockTranche { int trancheId; char *trancheName; + int num_lwlocks; } NamedLWLockTranche; extern PGDLLIMPORT NamedLWLockTranche *NamedLWLockTrancheArray;