summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/lmgr/lock.c10
-rw-r--r--src/include/storage/lock.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 5e36d91d615..17bc7257732 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -2211,6 +2211,16 @@ LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks)
locallock->numLockOwners = 0;
}
+#ifdef USE_ASSERT_CHECKING
+
+ /*
+ * Tuple locks are currently held only for short durations within a
+ * transaction. Check that we didn't forget to release one.
+ */
+ if (LOCALLOCK_LOCKTAG(*locallock) == LOCKTAG_TUPLE && !allLocks)
+ elog(WARNING, "tuple lock held at commit");
+#endif
+
/*
* If the lock or proclock pointers are NULL, this lock was taken via
* the relation fast-path (and is not known to have been transferred).
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 304e2a5c949..7066b0510b0 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -432,6 +432,7 @@ typedef struct LOCALLOCK
} LOCALLOCK;
#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid)
+#define LOCALLOCK_LOCKTAG(llock) ((LockTagType) (llock).tag.lock.locktag_type)
/*