forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit06bf404
committed
Ensure vacuum removes all visibly dead tuples older than OldestXmin
If vacuum fails to remove a tuple with xmax older thanVacuumCutoffs->OldestXmin and younger than GlobalVisState->maybe_needed,it will loop infinitely in lazy_scan_prune(), which compares tuples'visibility information to OldestXmin.Starting in version 14, which uses GlobalVisState for visibility testingduring pruning, it is possible for GlobalVisState->maybe_needed toprecede OldestXmin if maybe_needed is forced to go backward while vacuumis running. This can happen if a disconnected standby with a runningtransaction older than VacuumCutoffs->OldestXmin reconnects to theprimary after vacuum initially calculates GlobalVisState and OldestXmin.Fix this by having vacuum always remove tuples older than OldestXminduring pruning. This is okay because the standby won't replay the tupleremoval until the tuple is removable. Thus, the worst that can happen isa recovery conflict.Fixes BUG# 17257Back-patched in versions 14-17Author: Melanie PlagemanReviewed-by: Noah Misch, Peter Geoghegan, Robert Haas, Andres Freund, and Heikki LinnakangasDiscussion:https://postgr.es/m/CAAKRu_Y_NJzF4-8gzTTeaOuUL3CcGoXPjXcAHbTTygT8AyVqag%40mail.gmail.com1 parentd97f2ee commit06bf404
File tree
3 files changed
+40
-13
lines changed- src
- backend/access/heap
- include/access
3 files changed
+40
-13
lines changedLines changed: 37 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
36 |
| - | |
| 36 | + | |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
| |||
205 | 206 |
| |
206 | 207 |
| |
207 | 208 |
| |
208 |
| - | |
| 209 | + | |
| 210 | + | |
209 | 211 |
| |
210 | 212 |
| |
211 | 213 |
| |
| |||
247 | 249 |
| |
248 | 250 |
| |
249 | 251 |
| |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
255 | 260 |
| |
256 | 261 |
| |
257 | 262 |
| |
| |||
263 | 268 |
| |
264 | 269 |
| |
265 | 270 |
| |
| 271 | + | |
266 | 272 |
| |
267 | 273 |
| |
268 | 274 |
| |
| |||
290 | 296 |
| |
291 | 297 |
| |
292 | 298 |
| |
| 299 | + | |
293 | 300 |
| |
294 | 301 |
| |
295 | 302 |
| |
| |||
520 | 527 |
| |
521 | 528 |
| |
522 | 529 |
| |
523 |
| - | |
524 |
| - | |
525 |
| - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
526 | 546 |
| |
527 | 547 |
| |
528 |
| - | |
529 |
| - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
530 | 555 |
| |
531 | 556 |
| |
532 | 557 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1581 | 1581 |
| |
1582 | 1582 |
| |
1583 | 1583 |
| |
1584 |
| - | |
| 1584 | + | |
| 1585 | + | |
1585 | 1586 |
| |
1586 | 1587 |
| |
1587 | 1588 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
285 | 285 |
| |
286 | 286 |
| |
287 | 287 |
| |
| 288 | + | |
288 | 289 |
| |
289 | 290 |
| |
290 | 291 |
| |
|
0 commit comments
Comments
(0)