forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0668719
committed
Fix scenario where streaming standby gets stuck at a continuation record.
If a continuation record is split so that its first half has already beenremoved from the master, and is only present in pg_wal, and there is arecycled WAL segment in the standby server that looks like it wouldcontain the second half, recovery would get stuck. The code inXLogPageRead() incorrectly started streaming at the beginning of theWAL record, even if we had already read the first page.Backpatch to 9.4. In principle, older versions have the same problem, butwithout replication slots, there was no straightforward mechanism toprevent the master from recycling old WAL that was still needed by standby.Without such a mechanism, I think it's reasonable to assume that there'senough slack in how many old segments are kept around to not run into this,or you have a WAL archive.Reported by Jonathon Nelson. Analysis and patch by Kyotaro HORIGUCHI, withsome extra comments by me.Discussion:https://www.postgresql.org/message-id/CACJqAM3xVz0JY1XFDKPP%2BJoJAjoGx%3DGNuOAshEDWCext7BFvCQ%40mail.gmail.com1 parentd2599ec commit0668719
File tree
3 files changed
+62
-13
lines changed- src
- backend/access/transam
- include/access
3 files changed
+62
-13
lines changedLines changed: 42 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11694 | 11694 |
| |
11695 | 11695 |
| |
11696 | 11696 |
| |
| 11697 | + | |
| 11698 | + | |
| 11699 | + | |
| 11700 | + | |
| 11701 | + | |
| 11702 | + | |
| 11703 | + | |
| 11704 | + | |
| 11705 | + | |
| 11706 | + | |
| 11707 | + | |
| 11708 | + | |
| 11709 | + | |
| 11710 | + | |
| 11711 | + | |
| 11712 | + | |
| 11713 | + | |
| 11714 | + | |
| 11715 | + | |
| 11716 | + | |
| 11717 | + | |
| 11718 | + | |
| 11719 | + | |
| 11720 | + | |
| 11721 | + | |
| 11722 | + | |
| 11723 | + | |
| 11724 | + | |
| 11725 | + | |
| 11726 | + | |
| 11727 | + | |
| 11728 | + | |
| 11729 | + | |
| 11730 | + | |
11697 | 11731 |
| |
11698 | 11732 |
| |
11699 | 11733 |
| |
| |||
11828 | 11862 |
| |
11829 | 11863 |
| |
11830 | 11864 |
| |
11831 |
| - | |
| 11865 | + | |
| 11866 | + | |
| 11867 | + | |
| 11868 | + | |
| 11869 | + | |
| 11870 | + | |
11832 | 11871 |
| |
11833 | 11872 |
| |
11834 | 11873 |
| |
11835 | 11874 |
| |
11836 |
| - | |
| 11875 | + | |
| 11876 | + | |
11837 | 11877 |
| |
11838 | 11878 |
| |
11839 | 11879 |
| |
|
Lines changed: 16 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
31 |
| - | |
32 | 30 |
| |
33 | 31 |
| |
34 | 32 |
| |
| |||
533 | 531 |
| |
534 | 532 |
| |
535 | 533 |
| |
536 |
| - | |
537 | 534 |
| |
538 | 535 |
| |
539 | 536 |
| |
| |||
545 | 542 |
| |
546 | 543 |
| |
547 | 544 |
| |
548 |
| - | |
549 |
| - | |
550 |
| - | |
| 545 | + | |
| 546 | + | |
551 | 547 |
| |
552 | 548 |
| |
553 | 549 |
| |
| |||
584 | 580 |
| |
585 | 581 |
| |
586 | 582 |
| |
587 |
| - | |
| 583 | + | |
588 | 584 |
| |
589 | 585 |
| |
590 | 586 |
| |
| |||
709 | 705 |
| |
710 | 706 |
| |
711 | 707 |
| |
712 |
| - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
713 | 712 |
| |
714 |
| - | |
715 |
| - | |
716 |
| - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
717 | 716 |
| |
718 | 717 |
| |
719 | 718 |
| |
720 | 719 |
| |
| 720 | + | |
721 | 721 |
| |
722 | 722 |
| |
723 | 723 |
| |
| |||
805 | 805 |
| |
806 | 806 |
| |
807 | 807 |
| |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
808 | 813 |
| |
809 | 814 |
| |
810 | 815 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
205 | 205 |
| |
206 | 206 |
| |
207 | 207 |
| |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
208 | 212 |
| |
209 | 213 |
| |
210 | 214 |
| |
|
0 commit comments
Comments
(0)