forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit917dc7d
committed
Fix WAL-logging of FSM and VM truncation.
When a relation is truncated, it is important that the FSM is truncated aswell. Otherwise, after recovery, the FSM can return a page that has beentruncated away, leading to errors like:ERROR: could not read block 28991 in file "base/16390/572026": read only 0of 8192 bytesWe were using MarkBufferDirtyHint() to dirty the buffer holding the lastremaining page of the FSM, but during recovery, that might in fact notdirty the page, and the FSM update might be lost.To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()requires us to do WAL-logging ourselves, to protect from a torn page, ifchecksumming is enabled.Also fix an oversight in visibilitymap_truncate: it also needs to WAL-logwhen checksumming is enabled.Analysis by Pavan Deolasee.Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>1 parentb801e12 commit917dc7d
File tree
3 files changed
+128
-1
lines changed- src
- backend
- access/heap
- storage/freespace
- test/recovery/t
3 files changed
+128
-1
lines changedLines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
508 | 508 |
| |
509 | 509 |
| |
510 | 510 |
| |
| 511 | + | |
| 512 | + | |
| 513 | + | |
511 | 514 |
| |
512 | 515 |
| |
513 | 516 |
| |
| |||
523 | 526 |
| |
524 | 527 |
| |
525 | 528 |
| |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
526 | 537 |
| |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
527 | 543 |
| |
528 | 544 |
| |
529 | 545 |
| |
|
Lines changed: 19 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
330 | 334 |
| |
331 |
| - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
332 | 350 |
| |
333 | 351 |
| |
334 | 352 |
| |
|
Lines changed: 93 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + |
0 commit comments
Comments
(0)