]> granicus.if.org Git - postgresql/commit
Fix LISTEN/NOTIFY race condition reported by Laurent Birtz, by postponing
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Mar 2008 20:12:48 +0000 (20:12 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Mar 2008 20:12:48 +0000 (20:12 +0000)
commit0d52d7a71efd0f090b62f3bfa77bd0060aa560d5
tree8584b5bac7f46d29387f88931a4ce5bdbb985857
parent25a87d0f07f8db8c600e66dac84b97203fda8ef9
Fix LISTEN/NOTIFY race condition reported by Laurent Birtz, by postponing
pg_listener modifications commanded by LISTEN and UNLISTEN until the end
of the current transaction.  This allows us to hold the ExclusiveLock on
pg_listener until after commit, with no greater risk of deadlock than there
was before.  Aside from fixing the race condition, this gets rid of a
truly ugly kludge that was there before, namely having to ignore
HeapTupleBeingUpdated failures during NOTIFY.  There is a small potential
incompatibility, which is that if a transaction issues LISTEN or UNLISTEN
and then looks into pg_listener before committing, it won't see any resulting
row insertion or deletion, where before it would have.  It seems unlikely
that anyone would be depending on that, though.
src/backend/commands/async.c