forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd9bb719
committed
Avoid assertion failure with LISTEN in a serializable transaction.
If LISTEN is the only action in a serializable-mode transaction,and the session was not previously listening, and the notify queueis not empty, predicate.c reported an assertion failure. Thathappened because we'd acquire the transaction's initial snapshotduring PreCommit_Notify, which was called *after* predicate.cexpects any such snapshot to have been established.To fix, just swap the order of the PreCommit_Notify andPreCommit_CheckForSerializationFailure calls during CommitTransaction.This will imply holding the notify-insertion lock slightly longer,but the difference could only be meaningful in serializable mode,which is an expensive option anyway.It appears that this is just an assertion failure, with noconsequences in non-assert builds. A snapshot used only to scanthe notify queue could not have been involved in any serializationconflicts, so there would be nothing forPreCommit_CheckForSerializationFailure to do except assign it aprepareSeqNo and set the SXACT_FLAG_PREPARED flag. And given noconflicts, neither of those omissions affect the behavior ofReleasePredicateLocks. This admittedly once-over-lightly analysisis backed up by the lack of field reports of trouble.Per report from Mark Dilger. The bug is old, so back-patch to allsupported branches; but the new test case only goes back to 9.6,for lack of adequate isolationtester infrastructure before that.Discussion:https://postgr.es/m/3ac7f397-4d5f-be8e-f354-440020675694@gmail.comDiscussion:https://postgr.es/m/13881.1574557302@sss.pgh.pa.us1 parent1451287 commitd9bb719
File tree
3 files changed
+36
-10
lines changed- src
- backend/access/transam
- test/isolation
- expected
- specs
3 files changed
+36
-10
lines changedLines changed: 10 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2038 | 2038 |
| |
2039 | 2039 |
| |
2040 | 2040 |
| |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
2041 | 2049 |
| |
2042 | 2050 |
| |
2043 | 2051 |
| |
2044 | 2052 |
| |
2045 | 2053 |
| |
2046 | 2054 |
| |
2047 | 2055 |
| |
2048 |
| - | |
2049 |
| - | |
2050 |
| - | |
2051 |
| - | |
2052 |
| - | |
2053 |
| - | |
2054 |
| - | |
2055 | 2056 |
| |
2056 | 2057 |
| |
2057 | 2058 |
| |
| |||
2266 | 2267 |
| |
2267 | 2268 |
| |
2268 | 2269 |
| |
| 2270 | + | |
| 2271 | + | |
2269 | 2272 |
| |
2270 | 2273 |
| |
2271 | 2274 |
| |
2272 | 2275 |
| |
2273 | 2276 |
| |
2274 | 2277 |
| |
2275 | 2278 |
| |
2276 |
| - | |
2277 |
| - | |
2278 | 2279 |
| |
2279 | 2280 |
| |
2280 | 2281 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
88 | 99 |
| |
89 | 100 |
| |
90 | 101 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
| 45 | + | |
44 | 46 |
| |
45 | 47 |
| |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 |
| |
47 | 57 |
| |
48 | 58 |
| |
| |||
59 | 69 |
| |
60 | 70 |
| |
61 | 71 |
| |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
62 | 76 |
| |
63 | 77 |
| |
64 | 78 |
| |
|
0 commit comments
Comments
(0)