Detail part for still waiting for lock log message - Mailing list pgsql-hackers

From Tarvi Pillessaar
Subject Detail part for still waiting for lock log message
Date
Msg-id 52139795.1050105@gmail.com
Whole thread Raw
Responses Re: Detail part for still waiting for lock log message  (Kevin Grittner <kgrittn@ymail.com>)
Re: Detail part for still waiting for lock log message  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Hello!

 From time to time when investigating different locking issues using
postgres log i have thought that "process x is still waiting for"
message could be more informative, for example at the moment it is quite
painful to find out which session was actually holding that particular lock.

I would like to add detail part for this message to show information
about the lock holder and also show what the lock holder is actually
doing (yes, i know that i could get the lock holder's statement from the
log, but this not the same, maybe lock holder was idle in transaction).
So, i wrote a small patch, but i am not sure that this is the
best/correct way to do it.
Maybe someone can take a look at my patch and give some feedback.
Even if this idea won't reach to upstream, i would still like to get
feedback.

About patch:
Patch is tested against 9.2.4.
I was not sure that i should check if the lock holder's proclock was
found (as lock holder's proclock should be always there), check is there
to be on the safe side, but maybe it's unnecessary.
If it's not needed then fallback to old behavior (logging without
detail) is not needed as well.
And yes, i know that the lock holding time is not actually correct and
it actually shows milliseconds since transaction start.

Regards,
Tarvi Pillessaar

Attachment

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Next
From: Steve Crawford
Date:
Subject: Re: Personal note: taking some vacation time in Sep/Oct