forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd0e1fd9
committed
Make pg_ctl stop/restart/promote recheck postmaster aliveness.
"pg_ctl stop/restart" checked that the postmaster PID is valid justonce, as a side-effect of sending the stop signal, and then wouldwait-till-timeout for the postmaster.pid file to go away. Thisneglects the case wherein the postmaster dies uncleanly after wesignal it. Similarly, once "pg_ctl promote" has sent the signal,it'd wait for the corresponding on-disk state change to occureven if the postmaster dies.I'm not sure how we've managed not to notice this problem, but itseems to explain slow execution of the 017_shm.pl test script on AIXsince commit4fdbf9a, which added a speculative "pg_ctl stop" withthe idea of making real sure that the postmaster isn't there. In thetest steps that kill-9 and then restart the postmaster, it's possibleto get past the initial signal attempt before kill() stops workingfor the doomed postmaster. If that happens, pg_ctl waited tillPGCTLTIMEOUT before giving up ... and the buildfarm's AIX membershave that set very high.To fix, include a "kill(pid, 0)" test (similar to whatpostmaster_is_alive uses) in these wait loops, so that we'llgive up immediately if the postmaster PID disappears.While here, I chose to refactor those loops out of where they were.do_stop() and do_restart() can perfectly well share one copy of thewait-for-stop loop, and it seems desirable to put a similar functionbeside that for wait-for-promote.Back-patch to all supported versions, since pg_ctl's wait logicis substantially identical in all, and we're seeing the slow testbehavior in all branches.Discussion:https://postgr.es/m/20220210023537.GA3222837@rfd.leadboat.com1 parenteec7c64 commitd0e1fd9
1 file changed
+80
-48
lines changedLines changed: 80 additions & 48 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
159 | 161 |
| |
160 | 162 |
| |
161 | 163 |
| |
| |||
590 | 592 |
| |
591 | 593 |
| |
592 | 594 |
| |
593 |
| - | |
| 595 | + | |
594 | 596 |
| |
595 | 597 |
| |
596 | 598 |
| |
| |||
700 | 702 |
| |
701 | 703 |
| |
702 | 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 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
703 | 775 |
| |
704 | 776 |
| |
705 | 777 |
| |
| |||
914 | 986 |
| |
915 | 987 |
| |
916 | 988 |
| |
917 |
| - | |
| 989 | + | |
918 | 990 |
| |
919 | 991 |
| |
920 | 992 |
| |
| |||
949 | 1021 |
| |
950 | 1022 |
| |
951 | 1023 |
| |
952 |
| - | |
953 | 1024 |
| |
954 | 1025 |
| |
955 | 1026 |
| |
| |||
1000 | 1071 |
| |
1001 | 1072 |
| |
1002 | 1073 |
| |
1003 |
| - | |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 |
| - | |
1008 |
| - | |
1009 |
| - | |
1010 |
| - | |
1011 |
| - | |
1012 |
| - | |
1013 |
| - | |
1014 |
| - | |
1015 |
| - | |
| 1074 | + | |
1016 | 1075 |
| |
1017 | 1076 |
| |
1018 | 1077 |
| |
| |||
1036 | 1095 |
| |
1037 | 1096 |
| |
1038 | 1097 |
| |
1039 |
| - | |
1040 | 1098 |
| |
1041 | 1099 |
| |
1042 | 1100 |
| |
| |||
1090 | 1148 |
| |
1091 | 1149 |
| |
1092 | 1150 |
| |
1093 |
| - | |
1094 |
| - | |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 |
| - | |
1099 |
| - | |
1100 |
| - | |
1101 |
| - | |
1102 |
| - | |
1103 |
| - | |
1104 |
| - | |
1105 |
| - | |
1106 |
| - | |
| 1151 | + | |
1107 | 1152 |
| |
1108 | 1153 |
| |
1109 | 1154 |
| |
| |||
1228 | 1273 |
| |
1229 | 1274 |
| |
1230 | 1275 |
| |
1231 |
| - | |
1232 |
| - | |
1233 |
| - | |
1234 | 1276 |
| |
1235 |
| - | |
1236 |
| - | |
1237 |
| - | |
1238 |
| - | |
1239 |
| - | |
1240 |
| - | |
1241 |
| - | |
1242 |
| - | |
1243 |
| - | |
1244 |
| - | |
1245 |
| - | |
| 1277 | + | |
1246 | 1278 |
| |
1247 | 1279 |
| |
1248 | 1280 |
| |
| |||
1661 | 1693 |
| |
1662 | 1694 |
| |
1663 | 1695 |
| |
1664 |
| - | |
| 1696 | + | |
1665 | 1697 |
| |
1666 | 1698 |
| |
1667 | 1699 |
| |
| |||
1682 | 1714 |
| |
1683 | 1715 |
| |
1684 | 1716 |
| |
1685 |
| - | |
| 1717 | + | |
1686 | 1718 |
| |
1687 | 1719 |
| |
1688 | 1720 |
| |
|
0 commit comments
Comments
(0)