forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit61c20a5
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 parent64dd648 commit61c20a5
1 file changed
+80
-48
lines changedLines changed: 80 additions & 48 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
162 |
| - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
163 | 165 |
| |
164 | 166 |
| |
165 | 167 |
| |
| |||
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 |
| |
| |||
915 | 987 |
| |
916 | 988 |
| |
917 | 989 |
| |
918 |
| - | |
| 990 | + | |
919 | 991 |
| |
920 | 992 |
| |
921 | 993 |
| |
| |||
950 | 1022 |
| |
951 | 1023 |
| |
952 | 1024 |
| |
953 |
| - | |
954 | 1025 |
| |
955 | 1026 |
| |
956 | 1027 |
| |
| |||
1001 | 1072 |
| |
1002 | 1073 |
| |
1003 | 1074 |
| |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 |
| - | |
1008 |
| - | |
1009 |
| - | |
1010 |
| - | |
1011 |
| - | |
1012 |
| - | |
1013 |
| - | |
1014 |
| - | |
1015 |
| - | |
1016 |
| - | |
| 1075 | + | |
1017 | 1076 |
| |
1018 | 1077 |
| |
1019 | 1078 |
| |
| |||
1037 | 1096 |
| |
1038 | 1097 |
| |
1039 | 1098 |
| |
1040 |
| - | |
1041 | 1099 |
| |
1042 | 1100 |
| |
1043 | 1101 |
| |
| |||
1091 | 1149 |
| |
1092 | 1150 |
| |
1093 | 1151 |
| |
1094 |
| - | |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 |
| - | |
1099 |
| - | |
1100 |
| - | |
1101 |
| - | |
1102 |
| - | |
1103 |
| - | |
1104 |
| - | |
1105 |
| - | |
1106 |
| - | |
1107 |
| - | |
| 1152 | + | |
1108 | 1153 |
| |
1109 | 1154 |
| |
1110 | 1155 |
| |
| |||
1229 | 1274 |
| |
1230 | 1275 |
| |
1231 | 1276 |
| |
1232 |
| - | |
1233 |
| - | |
1234 |
| - | |
1235 | 1277 |
| |
1236 |
| - | |
1237 |
| - | |
1238 |
| - | |
1239 |
| - | |
1240 |
| - | |
1241 |
| - | |
1242 |
| - | |
1243 |
| - | |
1244 |
| - | |
1245 |
| - | |
1246 |
| - | |
| 1278 | + | |
1247 | 1279 |
| |
1248 | 1280 |
| |
1249 | 1281 |
| |
| |||
1688 | 1720 |
| |
1689 | 1721 |
| |
1690 | 1722 |
| |
1691 |
| - | |
| 1723 | + | |
1692 | 1724 |
| |
1693 | 1725 |
| |
1694 | 1726 |
| |
| |||
1709 | 1741 |
| |
1710 | 1742 |
| |
1711 | 1743 |
| |
1712 |
| - | |
| 1744 | + | |
1713 | 1745 |
| |
1714 | 1746 |
| |
1715 | 1747 |
| |
|
0 commit comments
Comments
(0)