- Notifications
You must be signed in to change notification settings - Fork5
Commit7834d20
committed
Avoid slow shutdown of pg_basebackup.
pg_basebackup's child process did not pay any attention to the pipefrom its parent while waiting for input from the source server.If no server data was arriving, it would only wake up and check thepipe every standby_message_timeout or so. This creates a problemsince the parent process might determine and send the desired stopposition only after the server has reached end-of-WAL and stoppedsending data. In the src/test/recovery regression tests, the timingis repeatably such that it takes nearly 10 seconds for the childprocess to realize that it should shut down. It's not clear howoften that would happen in real-world cases, but it sure seems likea bug --- and if the user turns off standby_message_timeout or setsit very large, the delay could be a lot worse.To fix, expand the StreamCtl API to allow the pipe input FD to bepassed down to the low-level wait routine, and watch both socketswhen sleeping.(Note: AFAICS this issue doesn't affect the Windows port, sinceit doesn't rely on a pipe to transfer the stop position to thechild thread.)Discussion:https://postgr.es/m/6456.1493263884@sss.pgh.pa.us1 parent9f11fce commit7834d20
File tree
4 files changed
+59
-28
lines changed- src/bin/pg_basebackup
4 files changed
+59
-28
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
480 | 480 |
| |
481 | 481 |
| |
482 | 482 |
| |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
483 | 488 |
| |
484 | 489 |
| |
485 | 490 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
409 | 409 |
| |
410 | 410 |
| |
411 | 411 |
| |
| 412 | + | |
412 | 413 |
| |
413 | 414 |
| |
414 | 415 |
| |
|
Lines changed: 50 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
42 |
| - | |
43 |
| - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
| |||
417 | 418 |
| |
418 | 419 |
| |
419 | 420 |
| |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
420 | 427 |
| |
421 | 428 |
| |
| 429 | + | |
422 | 430 |
| |
423 | 431 |
| |
424 | 432 |
| |
| |||
825 | 833 |
| |
826 | 834 |
| |
827 | 835 |
| |
828 |
| - | |
| 836 | + | |
829 | 837 |
| |
830 | 838 |
| |
831 | 839 |
| |
| |||
870 | 878 |
| |
871 | 879 |
| |
872 | 880 |
| |
873 |
| - | |
| 881 | + | |
874 | 882 |
| |
875 | 883 |
| |
876 | 884 |
| |
| |||
881 | 889 |
| |
882 | 890 |
| |
883 | 891 |
| |
884 |
| - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
885 | 895 |
| |
886 | 896 |
| |
887 |
| - | |
| 897 | + | |
888 | 898 |
| |
889 | 899 |
| |
890 |
| - | |
| 900 | + | |
891 | 901 |
| |
892 | 902 |
| |
893 | 903 |
| |
| 904 | + | |
| 905 | + | |
894 | 906 |
| |
895 | 907 |
| |
896 | 908 |
| |
897 |
| - | |
| 909 | + | |
| 910 | + | |
898 | 911 |
| |
899 | 912 |
| |
900 | 913 |
| |
901 | 914 |
| |
902 | 915 |
| |
903 | 916 |
| |
904 | 917 |
| |
905 |
| - | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
906 | 925 |
| |
907 | 926 |
| |
908 | 927 |
| |
| |||
913 | 932 |
| |
914 | 933 |
| |
915 | 934 |
| |
916 |
| - | |
917 |
| - | |
918 |
| - | |
919 |
| - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
920 | 938 |
| |
| 939 | + | |
| 940 | + | |
921 | 941 |
| |
922 | 942 |
| |
923 | 943 |
| |
924 | 944 |
| |
| 945 | + | |
| 946 | + | |
925 | 947 |
| |
926 |
| - | |
| 948 | + | |
927 | 949 |
| |
928 | 950 |
| |
929 | 951 |
| |
| |||
934 | 956 |
| |
935 | 957 |
| |
936 | 958 |
| |
937 |
| - | |
938 |
| - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
939 | 962 |
| |
940 | 963 |
| |
941 |
| - | |
| 964 | + | |
| 965 | + | |
942 | 966 |
| |
943 | 967 |
| |
944 | 968 |
| |
| |||
951 | 975 |
| |
952 | 976 |
| |
953 | 977 |
| |
| 978 | + | |
| 979 | + | |
954 | 980 |
| |
955 |
| - | |
956 |
| - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
957 | 984 |
| |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
965 |
| - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
966 | 988 |
| |
967 |
| - | |
| 989 | + | |
968 | 990 |
| |
969 | 991 |
| |
970 | 992 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 |
| |
46 | 49 |
| |
47 | 50 |
| |
|
0 commit comments
Comments
(0)