Re: Need help understanding pg_locks - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Need help understanding pg_locks
Date
Msg-id 0D291B78-249C-4F58-AE78-841BEF80CD32@phlo.org
Whole thread Raw
In response to Re: Need help understanding pg_locks  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Need help understanding pg_locks
List pgsql-hackers
On Jul14, 2011, at 19:06 , Bruce Momjian wrote:
> Florian Pflug wrote:
>> On Jul13, 2011, at 21:08 , Bruce Momjian wrote:
>>> +       OID of the relation lock target, or null if the lock is not
>>>       on a relation or part of a relation
>> 
>> That, however, not so much. "relation lock target" might easily
>> be interpreted as the "relation's lock target" or the
>> "relation lock's target" - at least by non-native speakers such
>> as myself. The same is true fro "transaction lock target" and
>> friends.
>> 
>> Can't we simply go with "Locked relation", "Locked transaction id"
>> and so on (as in my versions B,C and D up-thread)? I can't really
>> get excited about the slight imprecision caused by the fact that some
>> rows describe aspiring lock holders instead of current lock holders.
>> The existence of the "granted" column makes the situation pretty clear.
>> 
>> Plus, it's technically not even wrong - a process is waiting because
>> somebody else *is* actually holding a lock on the object. So
>> the tuple/transaction/... is, in fact, a "Locked tuple/transaction/..."
> 
> I think it will be very confusing to have "locked" refer to the person
> holding the lock while the row is based on who is waiting for it.

I still believe the chance of confusion to be extremely small, but since
you feel otherwise, what about "Targeted" instead of "Locked". As in
 OID of the relation targeted by the lock, or null if the lock does not target a relation or part of a relation.
 Page number within the relation targeted by the lock, or null if the lock does not target a tuple or a relation page.
 Virtual ID of the transaction targeted by the lock, or null if the lock does not target a virtual transaction ID.

"Protected"/"protects" instead of "Targeted"/"targets" would also work.

Both avoid the imprecision of saying "Locked", and the ambiguity "on" -
which might either mean the physical location of the lock, or the object
its protecting/targeting. 

> I reworded that line to:
> 
> +       OID of the relation of the lock target, or null if the lock is not

I'm not a huge fan of that. IMHO " .. of .. of .. " chains are hard to
read. Plus, there isn't such a thing as the "relation of a lock target" -
the relation *is* the lock target, not a part thereof.

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Pavan Deolasee
Date:
Subject: Re: Single pass vacuum - take 1
Next
From: Alvaro Herrera
Date:
Subject: Re: Single pass vacuum - take 1