- Notifications
You must be signed in to change notification settings - Fork28
Commit6b802cf
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 parent1974853 commit6b802cf
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 | |
---|---|---|---|
| |||
2112 | 2112 |
| |
2113 | 2113 |
| |
2114 | 2114 |
| |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
2115 | 2123 |
| |
2116 | 2124 |
| |
2117 | 2125 |
| |
| |||
2122 | 2130 |
| |
2123 | 2131 |
| |
2124 | 2132 |
| |
2125 |
| - | |
2126 |
| - | |
2127 |
| - | |
2128 |
| - | |
2129 |
| - | |
2130 |
| - | |
2131 |
| - | |
2132 | 2133 |
| |
2133 | 2134 |
| |
2134 | 2135 |
| |
| |||
2344 | 2345 |
| |
2345 | 2346 |
| |
2346 | 2347 |
| |
| 2348 | + | |
| 2349 | + | |
2347 | 2350 |
| |
2348 | 2351 |
| |
2349 | 2352 |
| |
2350 | 2353 |
| |
2351 | 2354 |
| |
2352 | 2355 |
| |
2353 | 2356 |
| |
2354 |
| - | |
2355 |
| - | |
2356 | 2357 |
| |
2357 | 2358 |
| |
2358 | 2359 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 |
| |
87 | 98 |
| |
88 | 99 |
| |
|
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)