Re: Strange locking choices in pg_shdepend.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Strange locking choices in pg_shdepend.c
Date: 2008-01-21 23:06:30
Message-ID: 21626.1200956790@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Tom Lane wrote:
>> Why does shdepDropOwned() take AccessExclusiveLock on pg_shdepend?

> Hmm, I can't recall nor deduce any reason for that. Perhaps the
> intention was to protect against itself; but I think this should only
> matter if we're dropping the same role concurrently (otherwise the
> to-be-dropped objects would be disjoint sets, so it doesn't matter),
> which should be already protected by the lock on the role itself.

> Hmm, unless revoking privileges concurrently, for two different users on
> the same object could cause a problem? I don't see us grabbing a lock
> on the object itself -- does this matter?

Well, if there is any such problem then it could be triggered by two
independent plain-ol-REVOKE commands, so I still don't see an argument
why shdepDropOwned is more at risk than anything else. I think we
should just downgrade the lock.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2008-01-21 23:29:51 Makefile support for Mac OS X Fat Binaries?
Previous Message Tom Lane 2008-01-21 23:03:29 Re: [GENERAL] setof record "out" syntax and returning records