forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2efbfb9
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 parent4ecee11 commit2efbfb9
1 file changed
+37
-4
lines changedLines changed: 37 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4906 | 4906 |
| |
4907 | 4907 |
| |
4908 | 4908 |
| |
4909 |
| - | |
4910 |
| - | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + | |
| 4912 | + | |
4911 | 4913 |
| |
4912 | 4914 |
| |
4913 | 4915 |
| |
| |||
4930 | 4932 |
| |
4931 | 4933 |
| |
4932 | 4934 |
| |
4933 |
| - | |
4934 |
| - | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
4935 | 4938 |
| |
4936 | 4939 |
| |
4937 | 4940 |
| |
| |||
5100 | 5103 |
| |
5101 | 5104 |
| |
5102 | 5105 |
| |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
5103 | 5122 |
| |
5104 | 5123 |
| |
5105 | 5124 |
| |
| |||
5160 | 5179 |
| |
5161 | 5180 |
| |
5162 | 5181 |
| |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
5163 | 5195 |
| |
5164 | 5196 |
| |
5165 | 5197 |
| |
| |||
5221 | 5253 |
| |
5222 | 5254 |
| |
5223 | 5255 |
| |
| 5256 | + | |
5224 | 5257 |
| |
5225 | 5258 |
| |
5226 | 5259 |
| |
|
0 commit comments
Comments
(0)