forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3c64dcb
committed
Prevent references to invalid relation pages after fresh promotion
If a standby crashes after promotion before having completed its firstpost-recovery checkpoint, then the minimal recovery point which marksthe LSN position where the cluster is able to reach consistency may beset to a position older than the first end-of-recovery checkpoint whileall the WAL available should be replayed. This leads to the instancethinking that it contains inconsistent pages, causing a PANIC and a hardinstance crash even if all the WAL available has not been replayed forcertain sets of records replayed. When in crash recovery,minRecoveryPoint is expected to always be set to InvalidXLogRecPtr,which forces the recovery to replay all the WAL available, so thiscommit makes sure that the local copy of minRecoveryPoint from thecontrol file is initialized properly and stays as it is while crashrecovery is performed. Once switching to archive recovery or if crashrecovery finishes, then the local copy minRecoveryPoint can be safelyupdated.Pavan Deolasee has reported and diagnosed the failure in the firstplace, and the base fix idea to rely on the local copy ofminRecoveryPoint comes from Kyotaro Horiguchi, which has been expandedinto a full-fledged patch by me. The test included in this commit hasbeen written by Álvaro Herrera and Pavan Deolasee, which I have modifiedto make it faster and more reliable with sleep phases.Backpatch down to all supported versions where the bug appears, aka 9.3which is where the end-of-recovery checkpoint is not run by the startupprocess anymore. The test gets easily supported down to 10, still ithas been tested on all branches.Reported-by: Pavan DeolaseeDiagnosed-by: Pavan DeolaseeReviewed-by: Pavan Deolasee, Kyotaro HoriguchiAuthor: Michael Paquier, Kyotaro Horiguchi, Pavan Deolasee, ÁlvaroHerreraDiscussion:https://postgr.es/m/CABOikdPOewjNL=05K5CbNMxnNtXnQjhTx2F--4p4ruorCjukbA@mail.gmail.com1 parent249126e commit3c64dcb
File tree
2 files changed
+157
-31
lines changed- src
- backend/access/transam
- test/recovery/t
2 files changed
+157
-31
lines changedLines changed: 70 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
821 | 821 |
| |
822 | 822 |
| |
823 | 823 |
| |
824 |
| - | |
825 |
| - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
826 | 832 |
| |
827 | 833 |
| |
828 | 834 |
| |
| |||
2711 | 2717 |
| |
2712 | 2718 |
| |
2713 | 2719 |
| |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
2714 | 2733 |
| |
2715 | 2734 |
| |
2716 | 2735 |
| |
2717 | 2736 |
| |
2718 | 2737 |
| |
2719 | 2738 |
| |
2720 |
| - | |
2721 |
| - | |
2722 |
| - | |
2723 |
| - | |
2724 |
| - | |
2725 |
| - | |
2726 |
| - | |
2727 |
| - | |
| 2739 | + | |
2728 | 2740 |
| |
2729 | 2741 |
| |
2730 | 2742 |
| |
| |||
3110 | 3122 |
| |
3111 | 3123 |
| |
3112 | 3124 |
| |
3113 |
| - | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
3114 | 3135 |
| |
3115 | 3136 |
| |
3116 | 3137 |
| |
| |||
3124 | 3145 |
| |
3125 | 3146 |
| |
3126 | 3147 |
| |
3127 |
| - | |
3128 |
| - | |
3129 |
| - | |
3130 |
| - | |
3131 |
| - | |
3132 |
| - | |
3133 |
| - | |
3134 |
| - | |
3135 |
| - | |
3136 | 3148 |
| |
3137 |
| - | |
3138 |
| - | |
3139 |
| - | |
3140 |
| - | |
| 3149 | + | |
3141 | 3150 |
| |
3142 | 3151 |
| |
3143 | 3152 |
| |
| |||
4269 | 4278 |
| |
4270 | 4279 |
| |
4271 | 4280 |
| |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
4272 | 4287 |
| |
4273 | 4288 |
| |
4274 | 4289 |
| |
| |||
6892 | 6907 |
| |
6893 | 6908 |
| |
6894 | 6909 |
| |
6895 |
| - | |
6896 |
| - | |
6897 |
| - | |
| 6910 | + | |
| 6911 | + | |
| 6912 | + | |
| 6913 | + | |
| 6914 | + | |
| 6915 | + | |
| 6916 | + | |
| 6917 | + | |
| 6918 | + | |
| 6919 | + | |
| 6920 | + | |
| 6921 | + | |
| 6922 | + | |
| 6923 | + | |
| 6924 | + | |
| 6925 | + | |
| 6926 | + | |
| 6927 | + | |
| 6928 | + | |
| 6929 | + | |
6898 | 6930 |
| |
6899 | 6931 |
| |
6900 | 6932 |
| |
| |||
7861 | 7893 |
| |
7862 | 7894 |
| |
7863 | 7895 |
| |
| 7896 | + | |
| 7897 | + | |
7864 | 7898 |
| |
7865 | 7899 |
| |
7866 | 7900 |
| |
| |||
9949 | 9983 |
| |
9950 | 9984 |
| |
9951 | 9985 |
| |
9952 |
| - | |
| 9986 | + | |
| 9987 | + | |
| 9988 | + | |
9953 | 9989 |
| |
9954 |
| - | |
9955 |
| - | |
9956 |
| - | |
| 9990 | + | |
| 9991 | + | |
| 9992 | + | |
| 9993 | + | |
| 9994 | + | |
| 9995 | + | |
9957 | 9996 |
| |
9958 | 9997 |
| |
9959 | 9998 |
| |
|
Lines changed: 87 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 | + |
0 commit comments
Comments
(0)