User locks code

From: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: User locks code
Date: 2001-08-17 18:48:49
Message-ID: 3705826352029646A3E91C53F7189E32016740@sectorbase2.sectorbase.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

1. Just noted this in contrib/userlock/README.user_locks:

> User locks, by Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
> Copyright (C) 1999, Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
>
> This software is distributed under the GNU General Public License
> either version 2, or (at your option) any later version.

Well, anyone can put code into contrib with whatever license
he/she want but "user locks" package includes interface
functions in contrib *and* changes in our lock manager, ie
changes in backend code. I wonder if backend' part of package
is covered by the same license above? And is it good if yes?

2. Not good implementation, imho.

It's too complex (separate lock method table, etc). Much cleaner
would be implement this feature the same way as transactions
wait other transaction commit/abort: by locking objects in
pseudo table. We could get rid of offnum and lockmethod from
LOCKTAG and add

struct
{
Oid RelId;
Oid ObjId;
} userObjId;

to objId union of LOCKTAG.

This way user could lock whatever object he/she want in specified
table and note that we would be able to use table access rights to
control if user allowed to lock objects in table - missed in 1.

One could object that 1. is good because user locks never wait.
I argue that "never waiting" for lock is same bad as "always waiting".
Someday we'll have time-wait etc features for general lock method
and everybody will be happy -:)

Comments?

Vadim
P.S. I could add 2. very fast, no matter if we'll keep 1. or not.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-17 18:51:59 Re: [HACKERS] Re: WIN32 errno patch
Previous Message Mitch Vincent 2001-08-17 18:26:53 Re: PostgreSQL v7.1.3 bundled and uploaded to central FTP Server