forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7bae028
committed
Avoid transaction-commit race condition while receiving a NOTIFY message.
Use TransactionIdIsInProgress, then TransactionIdDidCommit, to distinguishwhether a NOTIFY message's originating transaction is in progress,committed, or aborted. The previous coding could accept a message from atransaction that was still in-progress according to the PGPROC array;if the client were fast enough at starting a new transaction, it might failto see table rows added/updated by the message-sending transaction. Whichof course would usually be the point of receiving the message. We notedthis type of race condition long ago in tqual.c, but async.c overlooked it.The race condition probably cannot occur unless there are multiple NOTIFYsenders in action, since an individual backend doesn't send NOTIFY signalsuntil well after it's done committing. But if two senders commit in closesuccession, it's certainly possible that we could see the second sender'smessage within the race condition window while responding to the signalfrom the first one.Per bug #9557 from Marko Tiikkaja. This patch is slightly more invasivethan what he proposed, since it removes the now-redundantTransactionIdDidAbort call.Back-patch to 9.0, where the current NOTIFY implementation was introduced.1 parent16ff08b commit7bae028
1 file changed
+24
-18
lines changedLines changed: 24 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
| 129 | + | |
129 | 130 |
| |
130 | 131 |
| |
131 | 132 |
| |
| |||
1978 | 1979 |
| |
1979 | 1980 |
| |
1980 | 1981 |
| |
1981 |
| - | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
1982 | 2003 |
| |
1983 | 2004 |
| |
1984 | 2005 |
| |
| |||
1991 | 2012 |
| |
1992 | 2013 |
| |
1993 | 2014 |
| |
1994 |
| - | |
1995 |
| - | |
1996 |
| - | |
1997 |
| - | |
1998 |
| - | |
1999 |
| - | |
2000 |
| - | |
2001 | 2015 |
| |
2002 | 2016 |
| |
2003 | 2017 |
| |
2004 |
| - | |
2005 |
| - | |
2006 |
| - | |
2007 |
| - | |
2008 |
| - | |
2009 |
| - | |
2010 |
| - | |
| 2018 | + | |
| 2019 | + | |
2011 | 2020 |
| |
2012 |
| - | |
2013 |
| - | |
2014 |
| - | |
2015 | 2021 |
| |
2016 | 2022 |
| |
2017 | 2023 |
| |
|
0 commit comments
Comments
(0)