- Notifications
You must be signed in to change notification settings - Fork5
Commit08af921
committed
Fix order of shutdown cleanup operations in PostgresNode.pm.
Previously, database clusters created by a TAP test were shut down byDESTROY methods attached to the PostgresNode objects representing them.The trouble with that is that if the objects survive into the final globaldestruction phase (which they do), Perl executes the DESTROY methods in anunspecified order. Thus, the order of shutdown of multiple clusters wasindeterminate, which might lead to not-very-reproducible errors gettinglogged (eg from a slave whose master might or might not get killed first).Worse, the File::Temp objects representing the temporary PGDATA directoriesmight get destroyed before the PostgresNode objects, resulting in attemptsto delete PGDATA directories that still have live servers in them. OnWindows, this would lead to directory deletion failures; on Unix, itusually had no effects worse than erratic "could not open temporarystatistics file "pg_stat/global.tmp": No such file or directory" logmessages.While none of this would affect the reported result of the TAP test, whichis already determined, it could be very confusing when one is trying tounderstand from the logs what went wrong with a failed test.To fix, do the postmaster shutdowns in an END block rather than at objectdestruction time. The END block will execute at a well-defined (andreasonable) time during script termination, and it will stop thepostmasters in order of PostgresNode object creation. (Perhaps we shouldchange that to be reverse order of creation, but the main point here isthat we now have control which we did not before.) Use "pg_ctl stop", notan asynchronous kill(SIGQUIT), so that we wait for the postmasters to shutdown before proceeding with directory deletion.Deletion of temporary directories still happens in an unspecified orderduring global destruction, but I can see no reason to care about thatonce the postmasters are stopped.1 parent82311bc commit08af921
1 file changed
+17
-9
lines changedLines changed: 17 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
662 | 662 |
| |
663 | 663 |
| |
664 | 664 |
| |
| 665 | + | |
665 | 666 |
| |
666 | 667 |
| |
667 | 668 |
| |
| |||
826 | 827 |
| |
827 | 828 |
| |
828 | 829 |
| |
829 |
| - | |
830 |
| - | |
| 830 | + | |
| 831 | + | |
831 | 832 |
| |
832 | 833 |
| |
833 | 834 |
| |
| |||
889 | 890 |
| |
890 | 891 |
| |
891 | 892 |
| |
892 |
| - | |
893 |
| - | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
894 | 898 |
| |
895 |
| - | |
896 |
| - | |
897 |
| - | |
898 |
| - | |
899 |
| - | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
900 | 908 |
| |
901 | 909 |
| |
902 | 910 |
| |
|
0 commit comments
Comments
(0)