Skip site navigation (1) Skip section navigation (2)

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: Strange locking choices in pg_shdepend.c
Date: 2008-01-21 21:54:06
Message-ID: 20137.1200952446@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
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'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 we're setting ourselves up for potential
deadlock failures due to lock-upgrade.  It'd be safer (and faster too)
to just hold RowExclusiveLock through the whole operation.

			regards, tom lane

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2008-01-21 22:13:54
Subject: Re: [GENERAL] setof record "out" syntax and returning records
Previous:From: Tom LaneDate: 2008-01-21 21:13:32
Subject: Re: Polyphase Merge

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group