forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1e8c5cf
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 parent92f60f5 commit1e8c5cf
1 file changed
+80
-48
lines changed| 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 | | |
| |||
913 | 985 | | |
914 | 986 | | |
915 | 987 | | |
916 | | - | |
| 988 | + | |
917 | 989 | | |
918 | 990 | | |
919 | 991 | | |
| |||
948 | 1020 | | |
949 | 1021 | | |
950 | 1022 | | |
951 | | - | |
952 | 1023 | | |
953 | 1024 | | |
954 | 1025 | | |
| |||
999 | 1070 | | |
1000 | 1071 | | |
1001 | 1072 | | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
| 1073 | + | |
1015 | 1074 | | |
1016 | 1075 | | |
1017 | 1076 | | |
| |||
1035 | 1094 | | |
1036 | 1095 | | |
1037 | 1096 | | |
1038 | | - | |
1039 | 1097 | | |
1040 | 1098 | | |
1041 | 1099 | | |
| |||
1089 | 1147 | | |
1090 | 1148 | | |
1091 | 1149 | | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
| 1150 | + | |
1106 | 1151 | | |
1107 | 1152 | | |
1108 | 1153 | | |
| |||
1222 | 1267 | | |
1223 | 1268 | | |
1224 | 1269 | | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | 1270 | | |
1229 | | - | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
| 1271 | + | |
1240 | 1272 | | |
1241 | 1273 | | |
1242 | 1274 | | |
| |||
1655 | 1687 | | |
1656 | 1688 | | |
1657 | 1689 | | |
1658 | | - | |
| 1690 | + | |
1659 | 1691 | | |
1660 | 1692 | | |
1661 | 1693 | | |
| |||
1676 | 1708 | | |
1677 | 1709 | | |
1678 | 1710 | | |
1679 | | - | |
| 1711 | + | |
1680 | 1712 | | |
1681 | 1713 | | |
1682 | 1714 | | |
| |||
0 commit comments
Comments
(0)