pgsql: Report the current queries of all backends involved in a deadlock

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Report the current queries of all backends involved in a deadlock
Дата
Msg-id 20080321210831.58DEA7558DC@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Report the current queries of all backends involved in a deadlock
(if they'd be visible to the current user in pg_stat_activity).

This might look like it's subject to race conditions, but it's actually
pretty safe because at the time DeadLockReport() is constructing the
report, we haven't yet aborted our transaction and so we can expect that
everyone else involved in the deadlock is still blocked on some lock.
(There are corner cases where that might not be true, such as a statement
timeout triggering in another backend before we finish reporting; but at
worst we'd report a misleading activity string, so it seems acceptable
considering the usefulness of reporting the queries.)

Original patch by Itagaki Takahiro, heavily modified by me.

Modified Files:
--------------
    pgsql/src/backend/postmaster:
        pgstat.c (r1.169 -> r1.170)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/postmaster/pgstat.c?r1=1.169&r2=1.170)
    pgsql/src/backend/storage/lmgr:
        deadlock.c (r1.51 -> r1.52)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/lmgr/deadlock.c?r1=1.51&r2=1.52)
    pgsql/src/include:
        pgstat.h (r1.71 -> r1.72)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/pgstat.h?r1=1.71&r2=1.72)

В списке pgsql-committers по дате отправления:

Предыдущее
От: dim@pgfoundry.org (User Dim)
Дата:
Сообщение: prefix - prefix: fix DatumGetPrefixRange usage
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Give an explicit error for serial[], rather than silently