- Notifications
You must be signed in to change notification settings - Fork28
Commit8c34876
committed
Fix concurrent locking of tuple update chain
If several sessions are concurrently locking a tuple update chain withnonconflicting lock modes using an old snapshot, and they all succeed,it may happen that some of them fail because of restarting the loop (dueto a concurrent Xmax change) and getting an error in the subsequent passwhile trying to obtain a tuple lock that they already have in some tupleversion.This can only happen with very high concurrency (where a row is beingboth updated and FK-checked by multiple transactions concurrently), butit's been observed in the field and can have unpleasant consequencessuch as an FK check failing to see a tuple that definitely exists: ERROR: insert or update on table "child_table" violates foreign key constraint "fk_constraint_name" DETAIL: Key (keyid)=(123456) is not present in table "parent_table".(where the key is observably present in the table).Discussion:https://postgr.es/m/20170714210011.r25mrff4nxjhmf3g@alvherre.pgsql1 parent3b7bbee commit8c34876
1 file changed
+37
-4
lines changedLines changed: 37 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5550 | 5550 |
| |
5551 | 5551 |
| |
5552 | 5552 |
| |
5553 |
| - | |
5554 |
| - | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
5555 | 5557 |
| |
5556 | 5558 |
| |
5557 | 5559 |
| |
| |||
5574 | 5576 |
| |
5575 | 5577 |
| |
5576 | 5578 |
| |
5577 |
| - | |
5578 |
| - | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
5579 | 5582 |
| |
5580 | 5583 |
| |
5581 | 5584 |
| |
| |||
5774 | 5777 |
| |
5775 | 5778 |
| |
5776 | 5779 |
| |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
5777 | 5796 |
| |
5778 | 5797 |
| |
5779 | 5798 |
| |
| |||
5834 | 5853 |
| |
5835 | 5854 |
| |
5836 | 5855 |
| |
| 5856 | + | |
| 5857 | + | |
| 5858 | + | |
| 5859 | + | |
| 5860 | + | |
| 5861 | + | |
| 5862 | + | |
| 5863 | + | |
| 5864 | + | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
5837 | 5869 |
| |
5838 | 5870 |
| |
5839 | 5871 |
| |
| |||
5894 | 5926 |
| |
5895 | 5927 |
| |
5896 | 5928 |
| |
| 5929 | + | |
5897 | 5930 |
| |
5898 | 5931 |
| |
5899 | 5932 |
| |
|
0 commit comments
Comments
(0)