pgsql: Setup error context callback for transaction lock waits

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Setup error context callback for transaction lock waits
Date: 2014-03-19 18:11:56
Message-ID: E1WQKy4-00042v-Mr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f88d4cfc9d417dac2ee41a8f5e593898e56fd2bd

Modified Files
--------------
src/backend/access/heap/heapam.c | 80 ++++++++++++++-------
src/backend/access/nbtree/nbtinsert.c | 2 +-
src/backend/catalog/index.c | 8 ++-
src/backend/executor/execMain.c | 4 +-
src/backend/executor/execUtils.c | 3 +-
src/backend/replication/logical/snapbuild.c | 2 +-
src/backend/storage/lmgr/lmgr.c | 102 ++++++++++++++++++++++++++-
src/include/storage/lmgr.h | 17 ++++-
src/nls-global.mk | 5 +-
9 files changed, 189 insertions(+), 34 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-03-20 13:35:01 pgsql: test_shm_mq: Improve regression tests.
Previous Message Tom Lane 2014-03-19 15:10:19 pgsql: Fix memory leak during regular expression execution.