forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite6767c0
committed
Fix header check for continuation records where standbys could be stuck
XLogPageRead() checks immediately for an invalid WAL record header on astandby, to be able to handle the case of continuation records that needto be read across two different sources. As written, the check was toogeneric, applying to any target LSN. Based on an analysis by KyotaroHoriguchi, what really matters is to make sure that the page header ischecked when attempting to read a LSN at the boundary of a segment, tohandle the case of a continuation record that spawns across multiplepages when dealing with multiple segments, as WAL receivers are spawnedthey request WAL from the beginning of a segment. This fix has beenproposed by Kyotaro Horiguchi.This could cause standbys to loop infinitely when dealing with acontinuation record during a timeline jump, in the case where thecontents of the record in the follow-up page are invalid.Some regression tests are added to check such scenarios, able toreproduce the original problem. In the test, the contents of acontinuation record are overwritten with junk zeros on its follow-uppage, and replayed on standbys. This is inspired by 039_end_of_wal.pl,and is enough to show how standbys should react on promotion by notbeing stuck. Without the fix, the test would fail with a timeout. Thetest to reproduce the problem has been written by Alexander Kukushkin.The original check has been introduced in0668719, for a similarproblem.Author: Kyotaro Horiguchi, Alexander KukushkinReviewed-by: Michael PaquierDiscussion:https://postgr.es/m/CAFh8B=mozC+e1wGJq0H=0O65goZju+6ab5AU7DEWCSUA2OtwDg@mail.gmail.comBackpatch-through: 131 parentd1bf86a commite6767c0
File tree
3 files changed
+161
-6
lines changed- src
- backend/access/transam
- test/recovery
- t
3 files changed
+161
-6
lines changedLines changed: 7 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3436 | 3436 |
| |
3437 | 3437 |
| |
3438 | 3438 |
| |
3439 |
| - | |
3440 |
| - | |
3441 |
| - | |
3442 |
| - | |
3443 |
| - | |
3444 |
| - | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
3445 | 3445 |
| |
3446 | 3446 |
| |
3447 | 3447 |
| |
| |||
3463 | 3463 |
| |
3464 | 3464 |
| |
3465 | 3465 |
| |
| 3466 | + | |
3466 | 3467 |
| |
3467 | 3468 |
| |
3468 | 3469 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
54 | 55 |
| |
55 | 56 |
| |
56 | 57 |
|
Lines changed: 153 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 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + |
0 commit comments
Comments
(0)