forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit07f32fc
committed
Fix race condition in snapshot caching when 2PC is used.
When preparing a transaction xactCompletionCount needs to beincremented, even though the transaction has not committedyet. Otherwise the snapshot used within the transaction otherwise canget reused outside of the prepared transaction. As GetSnapshotData()does not include the current xid when building a snapshot, reuse wouldnot be correct.Somewhat surprisingly the regression tests only rarely show incorrectresults without the fix. The reason for that is that often thesnapshot's xmax will be >= the backend xid, yielding a snapshot thatis correct, despite the bug.I'm working on a reliable test for the bug, but it seems worth seeingwhether this fixes all the BF failures while I do.Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/E1k7tGP-0005V0-5k@gemulon.postgresql.org1 parent7344782 commit07f32fc
1 file changed
+9
-0
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
860 | 860 |
| |
861 | 861 |
| |
862 | 862 |
| |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
863 | 872 |
| |
864 | 873 |
| |
865 | 874 |
| |
|
0 commit comments
Comments
(0)