forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit033eb15
committed
Fix LISTEN/NOTIFY race condition reported by Laurent Birtz, by postponing
pg_listener modifications commanded by LISTEN and UNLISTEN until the endof the current transaction. This allows us to hold the ExclusiveLock onpg_listener until after commit, with no greater risk of deadlock than therewas before. Aside from fixing the race condition, this gets rid of atruly ugly kludge that was there before, namely having to ignoreHeapTupleBeingUpdated failures during NOTIFY. There is a small potentialincompatibility, which is that if a transaction issues LISTEN or UNLISTENand then looks into pg_listener before committing, it won't see any resultingrow insertion or deletion, where before it would have. It seems unlikelythat anyone would be depending on that, though.This patch also disallows LISTEN and UNLISTEN inside a prepared transaction.That case had some pretty undesirable properties already, such as possiblyallowing pg_listener entries to be made for PIDs no longer present, sodisallowing it seems like a better idea than trying to maintain the behavior.1 parent1c228fa commit033eb15
File tree
2 files changed
+344
-285
lines changed- doc/src/sgml/ref
- src/backend/commands
2 files changed
+344
-285
lines changedLines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
92 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
93 | 95 |
| |
94 | 96 |
| |
95 | 97 |
| |
|
0 commit comments
Comments
(0)