forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8a53539
committed
Wait for WAL summarization to catch up before creating .partial file.
When a standby is promoted, CleanupAfterArchiveRecovery() may decideto rename the final WAL file from the old timeline by adding ".partial"to the name. If WAL summarization is enabled and this file is renamedbefore its partial contents are summarized, WAL summarization breaks:the summarizer gets stuck at that point in the WAL stream and justerrors out.To fix that, first make the startup process wait for WAL summarizationto catch up before renaming the file. Generally, this should be quick,and if it's not, the user can shut off summarize_wal and try again.To make this fix work, also teach the WAL summarizer that after apromotion has occurred, no more WAL can appear on the previoustimeline: previously, the WAL summarizer wouldn't switch to the newtimeline until we actually started writing WAL there, but that meantthat when the startup process was waiting for the WAL summarizer, itwas waiting for an action that the summarizer wasn't yet prepared totake.In the process of fixing these bugs, I realized that the logic to waitfor WAL summarization to catch up was spread out in a way that madeit difficult to reuse properly, so this code refactors things to makeit easier.Finally, add a test case that would have caught this bug and thepreviously-fixed bug that WAL summarization sometimes needs to back upwhen the timeline changes.Discussion:https://postgr.es/m/CA+TgmoZGEsZodXC4f=XZNkAeyuDmWTSkpkjCEOcF19Am0mt_OA@mail.gmail.com1 parent454aab4 commit8a53539
File tree
7 files changed
+241
-110
lines changed- src
- backend
- access/transam
- backup
- postmaster
- bin/pg_combinebackup
- t
- include
- access
- postmaster
7 files changed
+241
-110
lines changedLines changed: 33 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
498 | 498 |
| |
499 | 499 |
| |
500 | 500 |
| |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
501 | 506 |
| |
502 | 507 |
| |
503 | 508 |
| |
| |||
5315 | 5320 |
| |
5316 | 5321 |
| |
5317 | 5322 |
| |
| 5323 | + | |
| 5324 | + | |
| 5325 | + | |
| 5326 | + | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
5318 | 5330 |
| |
5319 | 5331 |
| |
5320 | 5332 |
| |
| |||
5945 | 5957 |
| |
5946 | 5958 |
| |
5947 | 5959 |
| |
| 5960 | + | |
5948 | 5961 |
| |
5949 | 5962 |
| |
| 5963 | + | |
5950 | 5964 |
| |
5951 | 5965 |
| |
5952 | 5966 |
| |
| |||
6481 | 6495 |
| |
6482 | 6496 |
| |
6483 | 6497 |
| |
| 6498 | + | |
| 6499 | + | |
| 6500 | + | |
| 6501 | + | |
| 6502 | + | |
| 6503 | + | |
| 6504 | + | |
| 6505 | + | |
| 6506 | + | |
| 6507 | + | |
| 6508 | + | |
| 6509 | + | |
| 6510 | + | |
| 6511 | + | |
| 6512 | + | |
| 6513 | + | |
| 6514 | + | |
| 6515 | + | |
| 6516 | + | |
6484 | 6517 |
| |
6485 | 6518 |
| |
6486 | 6519 |
| |
|
Lines changed: 6 additions & 84 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
277 | 277 |
| |
278 | 278 |
| |
279 | 279 |
| |
280 |
| - | |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 | 280 |
| |
287 | 281 |
| |
288 | 282 |
| |
| |||
458 | 452 |
| |
459 | 453 |
| |
460 | 454 |
| |
461 |
| - | |
462 |
| - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
463 | 460 |
| |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
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 |
| - | |
| 461 | + | |
540 | 462 |
| |
541 | 463 |
| |
542 | 464 |
| |
|
Lines changed: 118 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
650 | 650 |
| |
651 | 651 |
| |
652 | 652 |
| |
653 |
| - | |
654 |
| - | |
| 653 | + | |
| 654 | + | |
655 | 655 |
| |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
| 656 | + | |
| 657 | + | |
660 | 658 |
| |
661 |
| - | |
662 |
| - | |
| 659 | + | |
| 660 | + | |
663 | 661 |
| |
664 |
| - | |
665 |
| - | |
666 |
| - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
667 | 667 |
| |
668 |
| - | |
669 |
| - | |
| 668 | + | |
670 | 669 |
| |
671 | 670 |
| |
672 | 671 |
| |
673 |
| - | |
674 |
| - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
675 | 681 |
| |
676 | 682 |
| |
677 | 683 |
| |
678 | 684 |
| |
679 | 685 |
| |
680 | 686 |
| |
681 |
| - | |
| 687 | + | |
682 | 688 |
| |
| 689 | + | |
| 690 | + | |
683 | 691 |
| |
684 | 692 |
| |
685 | 693 |
| |
686 |
| - | |
687 |
| - | |
688 |
| - | |
689 |
| - | |
690 |
| - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
691 | 771 |
| |
692 | 772 |
| |
693 | 773 |
| |
694 |
| - | |
| 774 | + | |
695 | 775 |
| |
696 | 776 |
| |
697 | 777 |
| |
698 | 778 |
| |
699 |
| - | |
700 |
| - | |
701 | 779 |
| |
702 | 780 |
| |
703 | 781 |
| |
| |||
730 | 808 |
| |
731 | 809 |
| |
732 | 810 |
| |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
733 | 827 |
| |
734 | 828 |
| |
735 | 829 |
| |
|
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 |
| |
|
0 commit comments
Comments
(0)