diff options
author | Alvaro Herrera | 2014-03-19 18:10:36 +0000 |
---|---|---|
committer | Alvaro Herrera | 2014-03-19 18:10:36 +0000 |
commit | f88d4cfc9d417dac2ee41a8f5e593898e56fd2bd (patch) | |
tree | 225a86782144a53e83e6083e92df29c8d0785007 /src/include | |
parent | ea8c7e9054abf23fa3de2f8e4414f60ac8a8b620 (diff) |
Setup error context callback for transaction lock waits
With this in place, a session blocking behind another one because of
tuple locks will get a context line mentioning the relation name, tuple
TID, and operation being done on tuple. For example:
LOG: process 11367 still waiting for ShareLock on transaction 717 after 1000.108 ms
DETAIL: Process holding the lock: 11366. Wait queue: 11367.
CONTEXT: while updating tuple (0,2) in relation "foo"
STATEMENT: UPDATE foo SET value = 3;
Most usefully, the new line is displayed by log entries due to
log_lock_waits, although of course it will be printed by any other log
message as well.
Author: Christian Kruse, some tweaks by Álvaro Herrera
Reviewed-by: Amit Kapila, Andres Freund, Tom Lane, Robert Haas
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/storage/lmgr.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index e74ae21b0f9..e9447b7dccf 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -20,6 +20,20 @@ #include "utils/rel.h" +/* XactLockTableWait operations */ +typedef enum XLTW_Oper +{ + XLTW_None, + XLTW_Update, + XLTW_Delete, + XLTW_Lock, + XLTW_LockUpdated, + XLTW_InsertIndex, + XLTW_InsertIndexUnique, + XLTW_FetchUpdated, + XLTW_RecheckExclusionConstr +} XLTW_Oper; + extern void RelationInitLockInfo(Relation relation); /* Lock a relation */ @@ -54,7 +68,8 @@ extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); /* Lock an XID (used to wait for a transaction to finish) */ extern void XactLockTableInsert(TransactionId xid); extern void XactLockTableDelete(TransactionId xid); -extern void XactLockTableWait(TransactionId xid); +extern void XactLockTableWait(TransactionId xid, Relation rel, + ItemPointer ctid, XLTW_Oper oper); extern bool ConditionalXactLockTableWait(TransactionId xid); /* Lock VXIDs, specified by conflicting locktags */ |