forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita745b93
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 parentea09a75 commita745b93
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 |
| |
| |||
594 | 596 |
| |
595 | 597 |
| |
596 | 598 |
| |
597 |
| - | |
| 599 | + | |
598 | 600 |
| |
599 | 601 |
| |
600 | 602 |
| |
| |||
704 | 706 |
| |
705 | 707 |
| |
706 | 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 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
707 | 779 |
| |
708 | 780 |
| |
709 | 781 |
| |
| |||
917 | 989 |
| |
918 | 990 |
| |
919 | 991 |
| |
920 |
| - | |
| 992 | + | |
921 | 993 |
| |
922 | 994 |
| |
923 | 995 |
| |
| |||
952 | 1024 |
| |
953 | 1025 |
| |
954 | 1026 |
| |
955 |
| - | |
956 | 1027 |
| |
957 | 1028 |
| |
958 | 1029 |
| |
| |||
1003 | 1074 |
| |
1004 | 1075 |
| |
1005 | 1076 |
| |
1006 |
| - | |
1007 |
| - | |
1008 |
| - | |
1009 |
| - | |
1010 |
| - | |
1011 |
| - | |
1012 |
| - | |
1013 |
| - | |
1014 |
| - | |
1015 |
| - | |
1016 |
| - | |
1017 |
| - | |
1018 |
| - | |
| 1077 | + | |
1019 | 1078 |
| |
1020 | 1079 |
| |
1021 | 1080 |
| |
| |||
1039 | 1098 |
| |
1040 | 1099 |
| |
1041 | 1100 |
| |
1042 |
| - | |
1043 | 1101 |
| |
1044 | 1102 |
| |
1045 | 1103 |
| |
| |||
1093 | 1151 |
| |
1094 | 1152 |
| |
1095 | 1153 |
| |
1096 |
| - | |
1097 |
| - | |
1098 |
| - | |
1099 |
| - | |
1100 |
| - | |
1101 |
| - | |
1102 |
| - | |
1103 |
| - | |
1104 |
| - | |
1105 |
| - | |
1106 |
| - | |
1107 |
| - | |
1108 |
| - | |
1109 |
| - | |
| 1154 | + | |
1110 | 1155 |
| |
1111 | 1156 |
| |
1112 | 1157 |
| |
| |||
1226 | 1271 |
| |
1227 | 1272 |
| |
1228 | 1273 |
| |
1229 |
| - | |
1230 |
| - | |
1231 |
| - | |
1232 | 1274 |
| |
1233 |
| - | |
1234 |
| - | |
1235 |
| - | |
1236 |
| - | |
1237 |
| - | |
1238 |
| - | |
1239 |
| - | |
1240 |
| - | |
1241 |
| - | |
1242 |
| - | |
1243 |
| - | |
| 1275 | + | |
1244 | 1276 |
| |
1245 | 1277 |
| |
1246 | 1278 |
| |
| |||
1659 | 1691 |
| |
1660 | 1692 |
| |
1661 | 1693 |
| |
1662 |
| - | |
| 1694 | + | |
1663 | 1695 |
| |
1664 | 1696 |
| |
1665 | 1697 |
| |
| |||
1680 | 1712 |
| |
1681 | 1713 |
| |
1682 | 1714 |
| |
1683 |
| - | |
| 1715 | + | |
1684 | 1716 |
| |
1685 | 1717 |
| |
1686 | 1718 |
| |
|
0 commit comments
Comments
(0)