forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaf275a1
committed
Follow TLI of last replayed record, not recovery target TLI, in walsenders.
Most of the time, the last replayed record comes from the recovery targettimeline, but there is a corner case where it makes a difference. Whenthe startup process scans for a new timeline, and decides to change recoverytarget timeline, there is a window where the recovery target TLI has alreadybeen bumped, but there are no WAL segments from the new timeline in pg_xlogyet. For example, if we have just replayed up to point 0/30002D8, ontimeline 1, there is a WAL file called 000000010000000000000003 in pg_xlogthat contains the WAL up to that point. When recovery switches recoverytarget timeline to 2, a walsender can immediately try to read WAL from0/30002D8, from timeline 2, so it will try to open WAL file000000020000000000000003. However, that doesn't exist yet - the startupprocess hasn't copied that file from the archive yet nor has the walreceiverstreamed it yet, so walsender fails with error "requested WAL segment000000020000000000000003 has already been removed". That's harmless, in thatthe standby will try to reconnect later and by that time the segment isalready created, but error messages that should be ignored are not good.To fix that, have walsender track the TLI of the last replayed record,instead of the recovery target timeline. That way walsender will not try toread anything from timeline 2, until the WAL segment has been created and atleast one record has been replayed from it. The recovery target timeline isnow xlog.c's internal affair, it doesn't need to be exposed in shared memoryanymore.This fixes the error reported by Thom Brown. depesz the same error message,but I'm not sure if this fixes his scenario.1 parent1a11d46 commitaf275a1
File tree
6 files changed
+92
-82
lines changed- src
- backend
- access/transam
- replication
- include/access
6 files changed
+92
-82
lines changedLines changed: 27 additions & 54 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
453 | 453 |
| |
454 | 454 |
| |
455 | 455 |
| |
| 456 | + | |
456 | 457 |
| |
457 | 458 |
| |
458 | 459 |
| |
| |||
3829 | 3830 |
| |
3830 | 3831 |
| |
3831 | 3832 |
| |
3832 |
| - | |
3833 | 3833 |
| |
3834 | 3834 |
| |
3835 | 3835 |
| |
| |||
3888 | 3888 |
| |
3889 | 3889 |
| |
3890 | 3890 |
| |
3891 |
| - | |
3892 |
| - | |
3893 |
| - | |
3894 |
| - | |
3895 | 3891 |
| |
3896 | 3892 |
| |
3897 | 3893 |
| |
3898 | 3894 |
| |
3899 |
| - | |
3900 |
| - | |
3901 |
| - | |
3902 |
| - | |
3903 |
| - | |
3904 |
| - | |
3905 | 3895 |
| |
3906 | 3896 |
| |
3907 | 3897 |
| |
| |||
5389 | 5379 |
| |
5390 | 5380 |
| |
5391 | 5381 |
| |
5392 |
| - | |
5393 |
| - | |
5394 |
| - | |
| 5382 | + | |
| 5383 | + | |
5395 | 5384 |
| |
5396 |
| - | |
5397 | 5385 |
| |
5398 | 5386 |
| |
5399 | 5387 |
| |
| |||
5770 | 5758 |
| |
5771 | 5759 |
| |
5772 | 5760 |
| |
| 5761 | + | |
5773 | 5762 |
| |
5774 | 5763 |
| |
5775 | 5764 |
| |
| |||
5837 | 5826 |
| |
5838 | 5827 |
| |
5839 | 5828 |
| |
| 5829 | + | |
5840 | 5830 |
| |
5841 | 5831 |
| |
5842 | 5832 |
| |
| |||
5942 | 5932 |
| |
5943 | 5933 |
| |
5944 | 5934 |
| |
| 5935 | + | |
5945 | 5936 |
| |
5946 | 5937 |
| |
5947 | 5938 |
| |
| |||
5974 | 5965 |
| |
5975 | 5966 |
| |
5976 | 5967 |
| |
| 5968 | + | |
5977 | 5969 |
| |
5978 | 5970 |
| |
5979 | 5971 |
| |
| |||
5982 | 5974 |
| |
5983 | 5975 |
| |
5984 | 5976 |
| |
| 5977 | + | |
| 5978 | + | |
| 5979 | + | |
| 5980 | + | |
| 5981 | + | |
| 5982 | + | |
| 5983 | + | |
5985 | 5984 |
| |
5986 | 5985 |
| |
5987 | 5986 |
| |
| |||
6822 | 6821 |
| |
6823 | 6822 |
| |
6824 | 6823 |
| |
6825 |
| - | |
6826 |
| - | |
6827 |
| - | |
6828 |
| - | |
6829 |
| - | |
6830 |
| - | |
6831 |
| - | |
6832 |
| - | |
6833 |
| - | |
6834 |
| - | |
6835 |
| - | |
6836 |
| - | |
6837 |
| - | |
6838 |
| - | |
6839 |
| - | |
6840 |
| - | |
6841 |
| - | |
6842 | 6824 |
| |
6843 | 6825 |
| |
6844 | 6826 |
| |
| |||
7642 | 7624 |
| |
7643 | 7625 |
| |
7644 | 7626 |
| |
| 7627 | + | |
| 7628 | + | |
7645 | 7629 |
| |
7646 | 7630 |
| |
7647 |
| - | |
7648 |
| - | |
| 7631 | + | |
| 7632 | + | |
| 7633 | + | |
| 7634 | + | |
| 7635 | + | |
| 7636 | + | |
7649 | 7637 |
| |
7650 | 7638 |
| |
7651 | 7639 |
| |
| |||
9109 | 9097 |
| |
9110 | 9098 |
| |
9111 | 9099 |
| |
9112 |
| - | |
| 9100 | + | |
9113 | 9101 |
| |
9114 | 9102 |
| |
9115 | 9103 |
| |
9116 | 9104 |
| |
| 9105 | + | |
9117 | 9106 |
| |
9118 | 9107 |
| |
9119 | 9108 |
| |
| 9109 | + | |
9120 | 9110 |
| |
9121 | 9111 |
| |
| 9112 | + | |
| 9113 | + | |
9122 | 9114 |
| |
9123 | 9115 |
| |
9124 | 9116 |
| |
9125 |
| - | |
9126 |
| - | |
9127 |
| - | |
9128 |
| - | |
9129 |
| - | |
9130 |
| - | |
9131 |
| - | |
9132 |
| - | |
9133 |
| - | |
9134 |
| - | |
9135 |
| - | |
9136 |
| - | |
9137 |
| - | |
9138 |
| - | |
9139 |
| - | |
9140 |
| - | |
9141 |
| - | |
9142 |
| - | |
9143 |
| - | |
9144 | 9117 |
| |
9145 | 9118 |
| |
9146 | 9119 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
248 | 248 |
| |
249 | 249 |
| |
250 | 250 |
| |
251 |
| - | |
| 251 | + | |
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
370 | 370 |
| |
371 | 371 |
| |
372 | 372 |
| |
373 |
| - | |
| 373 | + | |
374 | 374 |
| |
375 | 375 |
| |
376 | 376 |
| |
| |||
1026 | 1026 |
| |
1027 | 1027 |
| |
1028 | 1028 |
| |
1029 |
| - | |
| 1029 | + | |
1030 | 1030 |
| |
1031 | 1031 |
| |
1032 | 1032 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
324 | 324 |
| |
325 | 325 |
| |
326 | 326 |
| |
327 |
| - | |
| 327 | + | |
328 | 328 |
| |
329 | 329 |
| |
330 | 330 |
| |
|
Lines changed: 60 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
| 172 | + | |
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
| |||
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 | 194 |
| |
200 | 195 |
| |
201 | 196 |
| |
| |||
254 | 249 |
| |
255 | 250 |
| |
256 | 251 |
| |
257 |
| - | |
258 |
| - | |
| 252 | + | |
| 253 | + | |
259 | 254 |
| |
260 | 255 |
| |
261 | 256 |
| |
| |||
409 | 404 |
| |
410 | 405 |
| |
411 | 406 |
| |
| 407 | + | |
412 | 408 |
| |
413 | 409 |
| |
414 | 410 |
| |
| |||
421 | 417 |
| |
422 | 418 |
| |
423 | 419 |
| |
424 |
| - | |
| 420 | + | |
| 421 | + | |
425 | 422 |
| |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
426 | 431 |
| |
427 | 432 |
| |
428 | 433 |
| |
| |||
494 | 499 |
| |
495 | 500 |
| |
496 | 501 |
| |
497 |
| - | |
498 | 502 |
| |
499 | 503 |
| |
500 | 504 |
| |
| |||
516 | 520 |
| |
517 | 521 |
| |
518 | 522 |
| |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 | 523 |
| |
524 | 524 |
| |
525 | 525 |
| |
| |||
1330 | 1330 |
| |
1331 | 1331 |
| |
1332 | 1332 |
| |
1333 |
| - | |
| 1333 | + | |
1334 | 1334 |
| |
1335 | 1335 |
| |
1336 | 1336 |
| |
| |||
1347 | 1347 |
| |
1348 | 1348 |
| |
1349 | 1349 |
| |
1350 |
| - | |
1351 | 1350 |
| |
1352 | 1351 |
| |
1353 | 1352 |
| |
1354 | 1353 |
| |
1355 | 1354 |
| |
1356 | 1355 |
| |
1357 | 1356 |
| |
1358 |
| - | |
1359 | 1357 |
| |
1360 | 1358 |
| |
1361 | 1359 |
| |
1362 | 1360 |
| |
1363 | 1361 |
| |
1364 | 1362 |
| |
1365 | 1363 |
| |
1366 |
| - | |
| 1364 | + | |
1367 | 1365 |
| |
1368 |
| - | |
1369 |
| - | |
1370 |
| - | |
| 1366 | + | |
1371 | 1367 |
| |
1372 | 1368 |
| |
1373 | 1369 |
| |
| |||
1380 | 1376 |
| |
1381 | 1377 |
| |
1382 | 1378 |
| |
1383 |
| - | |
| 1379 | + | |
1384 | 1380 |
| |
1385 | 1381 |
| |
1386 | 1382 |
| |
| |||
1521 | 1517 |
| |
1522 | 1518 |
| |
1523 | 1519 |
| |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
1524 | 1562 |
| |
1525 | 1563 |
| |
1526 | 1564 |
| |
|
0 commit comments
Comments
(0)