Re: Detail part for still waiting for lock log message

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tarvi Pillessaar <tarvip(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Detail part for still waiting for lock log message
Date: 2013-08-27 16:46:41
Message-ID: 20130827164640.GB4933@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-08-27 17:14:32 Re: pg_restore multiple --function options
Previous Message Greg Smith 2013-08-27 16:45:11 Re: Backup throttling