Re: pg_locks needs a facelift

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: pg_locks needs a facelift
Date: 2005-05-02 17:30:49
Message-ID: 29940.1115055049@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> writes:
> I don't like the idea of listing user locks with 'tuple' locks for no
> other reason than this might confuse what user locks are.

Fair enough, although I think that at least one major application of
user locks would be equivalent to tuple locks. Somebody was asking
for named user locks in the previous thread, and the easiest way to
get that is to make a table containing just lock names, and then lock
on the CTIDs of that table. Since there would be no reason to allow
UPDATE or DELETE in such a table, the putative instability of CTID
doesn't really matter.

However, displaying them as object locks certainly works, and you'd have
to put some intelligence in front of the view anyway about what meaning
you were assigning to user locks in your installation. So you can
always cast to whatever you need.

> IMO, this is a problem with the current user lock module...it
> encourages locking over oid which is a bad practice. A properly
> implemented user lock system would likely maintain a global sequence
> shared by all lockable objects, tuple or otherwise.

Certainly the current contrib/userlock code could stand a rewrite.
Or more likely, addition of new functions --- we should deprecate
the old ones, but I see no need to remove 'em right away.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2005-05-02 17:32:35 Re: [HACKERS] Increased company involvement
Previous Message Bruce Momjian 2005-05-02 17:28:46 Re: [HACKERS] Increased company involvement