forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf61e1dd
committed
Allow pg_receivewal to stream from a slot's restart LSN
Prior to this patch, when running pg_receivewal, the streaming startpoint would be the current location of the archives if anything isfound in the local directory where WAL segments are written, andpg_receivewal would fall back to the current WAL flush location if thereare no archives, as of the result of an IDENTIFY_SYSTEM command.If for some reason the WAL files from pg_receivewal were moved, it isbetter to try a restart where we left at, which is the replicationslot's restart_lsn instead of skipping right to the current flushlocation, to avoid holes in the WAL backed up. This commit changespg_receivewal to use the following sequence of methods to determine thestarting streaming LSN:- Scan the local archives.- Use the slot's restart_lsn, if supported by the backend and if a slotis defined.- Fallback to the current flush LSN as reported by IDENTIFY_SYSTEM.To keep compatibility with older server versions, we only attempt to useREAD_REPLICATION_SLOT if the backend version is at least 15, andfallback to the older behavior of streaming from the current flushLSN if the command is not supported.Some TAP tests are added to cover this feature.Author: Ronan DunklauReviewed-by: Kyotaro Horiguchi, Michael Paquier, Bharath RupireddyDiscussion:https://postgr.es/m/18708360.4lzOvYHigE@aivenronan1 parent8781b0c commitf61e1dd
File tree
5 files changed
+191
-4
lines changed- doc/src/sgml/ref
- src/bin/pg_basebackup
- t
5 files changed
+191
-4
lines changedLines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
91 | 102 |
| |
92 | 103 |
| |
93 | 104 |
| |
|
Lines changed: 28 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
404 | 404 |
| |
405 | 405 |
| |
406 | 406 |
| |
407 |
| - | |
| 407 | + | |
408 | 408 |
| |
409 | 409 |
| |
410 | 410 |
| |
411 | 411 |
| |
412 |
| - | |
413 |
| - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
414 | 436 |
| |
415 | 437 |
| |
| 438 | + | |
| 439 | + | |
| 440 | + | |
416 | 441 |
| |
417 | 442 |
| |
418 | 443 |
| |
|
Lines changed: 97 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
479 | 479 |
| |
480 | 480 |
| |
481 | 481 |
| |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
482 | 579 |
| |
483 | 580 |
| |
484 | 581 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 |
| |
56 | 59 |
| |
57 | 60 |
| |
|
Lines changed: 52 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
| 8 | + | |
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
| 75 | + | |
| 76 | + | |
75 | 77 |
| |
76 | 78 |
| |
77 | 79 |
| |
| |||
155 | 157 |
| |
156 | 158 |
| |
157 | 159 |
| |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + |
0 commit comments
Comments
(0)