Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-28 Thread Alvaro Herrera
Tom Lane wrote: > Decibel! <[EMAIL PROTECTED]> writes: > > Would it be worthwhile to allow for logging when a lock gets upgraded? > > That would make it easier to protect against deadlocks... > > There is some debug code for that in the backend, but my experience > is that it's too noisy to have o

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-28 Thread Tom Lane
Decibel! <[EMAIL PROTECTED]> writes: > Would it be worthwhile to allow for logging when a lock gets upgraded? > That would make it easier to protect against deadlocks... There is some debug code for that in the backend, but my experience is that it's too noisy to have on by default.

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-28 Thread Decibel!
On Mon, Jan 21, 2008 at 04:54:06PM -0500, Tom Lane wrote: > It's probably not a good idea to have shdepReassignOwned() take only > AccessShareLock on pg_shdepend. Even though the function itself > merely reads the table, it is going to call functions that will take > RowExclusiveLock, meaning that

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-23 Thread Alvaro Herrera
Alvaro Herrera wrote: > 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? I tried a simple test: a process in a loop calling GRANT and REVOKE on random users

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-23 Thread Alvaro Herrera
Tom Lane wrote: > 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. Both issues fixed, thanks. -- Al

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-21 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> 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 t

Re: [HACKERS] Strange locking choices in pg_shdepend.c

2008-01-21 Thread Alvaro Herrera
Tom Lane wrote: > I came across some rather strange choices of lock levels in pg_shdepend.c. > > Why does shdepDropOwned() take AccessExclusiveLock on pg_shdepend? > Seems like RowExclusiveLock should be sufficient. If it isn't > sufficient, I wonder whether the other functions in here are taking

[HACKERS] Strange locking choices in pg_shdepend.c

2008-01-21 Thread Tom Lane
I came across some rather strange choices of lock levels in pg_shdepend.c. Why does shdepDropOwned() take AccessExclusiveLock on pg_shdepend? Seems like RowExclusiveLock should be sufficient. If it isn't sufficient, I wonder whether the other functions in here are taking strong enough locks. It'