From d482d1cefab3575104aa179e7d44bfaa84d75ff5 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Fri, 15 Dec 2017 13:25:11 +0900
Subject: [PATCH 3/3] Check tranche name on LWLock

---
 src/backend/storage/lmgr/lwlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index db197a6..bcb67be 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -1159,6 +1159,8 @@ LWLockAcquire(LWLock *lock, LWLockMode mode)
 	 * to catch unsafe coding practices.
 	 */
 	Assert(!(proc == NULL && IsUnderPostmaster));
+	/* And the tranche for this lock must have a tranche name */
+	Assert(!LWLockTrancheArray || T_NAME(lock));
 
 	/* Ensure we will have room to remember the lock */
 	if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
-- 
2.9.2

