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

From Alvaro Herrera
Subject Re: Detail part for still waiting for lock log message
Date
Msg-id 20130827164640.GB4933@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Detail part for still waiting for lock log message  (Tarvi Pillessaar <tarvip@gmail.com>)
List pgsql-hackers
Tarvi Pillessaar escribió:
> Thank you for feedback.
> 
> On 26.08.2013 22:20, Alvaro Herrera wrote:
> 
> >1. this assumes there is only one holder, which is not correct.
> >(Consider two backends holding shared lock on something and another one
> >stuck trying to acquire exclusive)
> Hmm, true. Then it's not that simple as I thought in first place.
> I guess it is possible to find all those backends that are holding
> that shared lock, but i'm not sure about the usefulness anymore as
> this list can be huge.

We already do this for deadlock reports, so I think it's fine.

> >2. I think pgstat_get_backend_current_activity() can be helpful.
> Yes, I saw that function, but i also wanted tx start time.

So add that.  But note the existing function has checks for
"changecount" and stuff that your code didn't.  I think for robustness
you need to add that too.

> >3. Doesn't this risk excessive overhead?
> About the overhead, i may be wrong, but i was thinking that that
> particular backend will be put to sleep anyway and also in normal
> workload such log messages are not very common (or at least
> shouldn't be).

I guess there's no way to know how long the process is going to sleep
after logging this message.

> >  Can the other backends be gone
> >(or done with the lock) before the report has completed?  If this
> >happens, is there a problem?
> That's why i have added check if other backend is found etc, but
> maybe i missed something. This is one of reasons why i wanted
> feedback.

Make sure you understand the "changecount" stuff and the reasons to use
it in pgstat_get_backend_current_activity.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: Backup throttling
Next
From: Heikki Linnakangas
Date:
Subject: Re: pg_restore multiple --function options