Fix LISTEN/NOTIFY race condition reported by Laurent Birtz, by postponing
authorTom Lane <[email protected]>
Wed, 12 Mar 2008 20:12:39 +0000 (20:12 +0000)
committerTom Lane <[email protected]>
Wed, 12 Mar 2008 20:12:39 +0000 (20:12 +0000)
commit8ad83d1898a814e2486673929c183f757b6b792f
tree02b221f5ab42ff4dacc2335c0343c69bf924cffe
parent491e88845218728f37b2474b88cf257c47d4a70a
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