Re: Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire

From: Christian Kruse <christian(at)2ndquadrant(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire
Date: 2014-01-22 16:04:42
Message-ID: 20140122160442.GK23743@defunct.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 22/01/14 12:40, Simon Riggs wrote:
> > 1. I find a issue in following scenario:
> >
> > session 1 with process id X: BEGIN; LOCK TABLE foo IN SHARE MODE;
> > session 2 with process id Y: BEGIN; LOCK TABLE foo IN EXCLUSIVE MODE;
> > session 3 with process id Z: BEGIN; LOCK TABLE foo IN SHARE MODE;
> >
> > On execution of LOCK in session-3, as part of log it will display as:
> > processes owning lock: X, Y
> > But actually if we see Y has not yet own the lock, it is still waiting with higher priority.
> > It may mislead user.
> > May be we should change message to give all meaning i.e. which process is owning lock and
> > Which process is already in queue.
>
> Perhaps this?
>
> CONTEXT: lock owner XXXX request queue XXX, XXX, XXX, etc

Fixed.

> > 2. Can we give a better name to new variable 'buf1'?

Fixed.

> > 3. Do we need to take performance reading to see if any impact?
>
> Don't think so. Diagnosing problems will help performance, not hinder it

I agree. And this code path will only get executed when log_lock_waits
= on, which seems to be a debugging method to me.

Best regards,

--
Christian Kruse http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
show_pids_in_lock_log_v2.patch text/x-diff 4.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-01-22 16:17:29 Re: Patch: Show process IDs of processes holding a lock; show relation and tuple infos of a lock to acquire
Previous Message Andres Freund 2014-01-22 15:48:58 Re: Changeset Extraction v7.0 (was logical changeset generation)