- Notifications
You must be signed in to change notification settings - Fork5
Commit990fe3c
committed
Fix more issues with cascading replication and timeline switches.
When a standby server follows the master using WAL archive, and it choosesa new timeline (recovery_target_timeline='latest'), it only fetches thetimeline history file for the chosen target timeline, not any other historyfiles that might be missing from pg_xlog. For example, if the currenttimeline is 2, and we choose 4 as the new recovery target timeline, thehistory file for timeline 3 is not fetched, even if it's part of thisserver's history. That's enough for the standby itself - the history filefor timeline 4 includes timeline 3 as well - but if a cascading standbyserver wants to recover to timeline 3, it needs the history file. To fix,when a new recovery target timeline is chosen, try to copy any missinghistory files from the archive to pg_xlog between the old and new targettimeline.A second similar issue was with the WAL files. When a standby recovers fromarchive, and it reaches a segment that contains a switch to a new timeline,recovery fetches only the WAL file labelled with the new timeline's ID. Thefile from the new timeline contains a copy of the WAL from the old timelineup to the point where the switch happened, and recovery recovers it from thenew file. But in streaming replication, walsender only tries to read itfrom the old timeline's file. To fix, change walsender to read it from thenew file, so that it behaves the same as recovery in that sense, and doesn'ttry to open the possibly nonexistent file with the old timeline's ID.1 parent861ad67 commit990fe3c
File tree
5 files changed
+92
-11
lines changed- src
- backend
- access/transam
- replication
- include
- access
- replication
5 files changed
+92
-11
lines changedLines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
43 | 65 |
| |
44 | 66 |
| |
45 | 67 |
| |
|
Lines changed: 21 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3276 | 3276 |
| |
3277 | 3277 |
| |
3278 | 3278 |
| |
| 3279 | + | |
3279 | 3280 |
| |
3280 |
| - | |
3281 | 3281 |
| |
3282 | 3282 |
| |
3283 | 3283 |
| |
| |||
3336 | 3336 |
| |
3337 | 3337 |
| |
3338 | 3338 |
| |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
3339 | 3345 |
| |
3340 | 3346 |
| |
3341 | 3347 |
| |
| |||
4993 | 4999 |
| |
4994 | 5000 |
| |
4995 | 5001 |
| |
| 5002 | + | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
4996 | 5016 |
| |
4997 | 5017 |
| |
4998 | 5018 |
| |
|
Lines changed: 48 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
110 | 110 |
| |
111 | 111 |
| |
112 | 112 |
| |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 |
| |
114 | 117 |
| |
115 | 118 |
| |
| |||
1201 | 1204 |
| |
1202 | 1205 |
| |
1203 | 1206 |
| |
1204 |
| - | |
1205 |
| - | |
| 1207 | + | |
| 1208 | + | |
1206 | 1209 |
| |
1207 | 1210 |
| |
1208 | 1211 |
| |
| |||
1222 | 1225 |
| |
1223 | 1226 |
| |
1224 | 1227 |
| |
1225 |
| - | |
| 1228 | + | |
1226 | 1229 |
| |
1227 | 1230 |
| |
1228 | 1231 |
| |
1229 | 1232 |
| |
1230 | 1233 |
| |
1231 | 1234 |
| |
1232 | 1235 |
| |
1233 |
| - | |
1234 | 1236 |
| |
1235 |
| - | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1236 | 1275 |
| |
1237 | 1276 |
| |
1238 | 1277 |
| |
| |||
1246 | 1285 |
| |
1247 | 1286 |
| |
1248 | 1287 |
| |
1249 |
| - | |
| 1288 | + | |
1250 | 1289 |
| |
1251 | 1290 |
| |
1252 | 1291 |
| |
| |||
1263 | 1302 |
| |
1264 | 1303 |
| |
1265 | 1304 |
| |
1266 |
| - | |
| 1305 | + | |
1267 | 1306 |
| |
1268 | 1307 |
| |
1269 | 1308 |
| |
| |||
1280 | 1319 |
| |
1281 | 1320 |
| |
1282 | 1321 |
| |
1283 |
| - | |
| 1322 | + | |
1284 | 1323 |
| |
1285 | 1324 |
| |
1286 | 1325 |
| |
| |||
1524 | 1563 |
| |
1525 | 1564 |
| |
1526 | 1565 |
| |
1527 |
| - | |
| 1566 | + | |
1528 | 1567 |
| |
1529 | 1568 |
| |
1530 | 1569 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
98 |
| - | |
99 | 98 |
| |
100 | 99 |
| |
101 | 100 |
| |
|
0 commit comments
Comments
(0)