forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit621a99a
committed
Fix longstanding bug in HeapTupleSatisfiesVacuum().
HeapTupleSatisfiesVacuum() didn't properly discern betweenDELETE_IN_PROGRESS and INSERT_IN_PROGRESS for rows that have beeninserted in the current transaction and deleted in a abortedsubtransaction of the current backend. At the very least that causedproblems for CLUSTER and CREATE INDEX in transactions that hadaborting subtransactions producing rows, leading to warnings like:WARNING: concurrent delete in progress within table "..."possibly in an endless, uninterruptible, loop.Instead of treating *InProgress xmins the same as *IsCurrent ones,treat them as being distinct like the other visibility routines. Asimplemented this separatation can cause a behaviour change for rowsthat have been inserted and deleted in another, still running,transaction. HTSV will now return INSERT_IN_PROGRESS instead ofDELETE_IN_PROGRESS for those. That's both, more in line with the othervisibility routines and arguably more correct. The latter because aINSERT_IN_PROGRESS will make callers look at/wait for xmin, instead ofxmax.The only current caller where that's possibly worse than the oldbehaviour is heap_prune_chain() which now won't mark the page asprunable if a row has concurrently been inserted and deleted. That'sharmless enough.As a cautionary measure also insert a interrupt check before the gotosin IndexBuildHeapScan() that lead to the uninterruptible loop. Thereare other possible causes, like a row that several sessions try toupdate and all fail, for repeated loops and the cost of doing so inthe retry case is low.As this bug goes back all the way to the introduction ofsubtransactions in573a71a backpatch to all supported releases.Reported-By: Sandro Santilli1 parentc8c9c1f commit621a99a
2 files changed
+19
-2
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2298 | 2298 |
| |
2299 | 2299 |
| |
2300 | 2300 |
| |
| 2301 | + | |
2301 | 2302 |
| |
2302 | 2303 |
| |
2303 | 2304 |
| |
| |||
2346 | 2347 |
| |
2347 | 2348 |
| |
2348 | 2349 |
| |
| 2350 | + | |
2349 | 2351 |
| |
2350 | 2352 |
| |
2351 | 2353 |
| |
|
Lines changed: 17 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1166 | 1166 |
| |
1167 | 1167 |
| |
1168 | 1168 |
| |
1169 |
| - | |
| 1169 | + | |
1170 | 1170 |
| |
1171 | 1171 |
| |
1172 | 1172 |
| |
| |||
1175 | 1175 |
| |
1176 | 1176 |
| |
1177 | 1177 |
| |
1178 |
| - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
1179 | 1194 |
| |
1180 | 1195 |
| |
1181 | 1196 |
| |
|
0 commit comments
Comments
(0)