forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1e6e98f
committed
Fix libpq's implementation of per-host connection timeouts.
Commit5f374fe attempted to turn the connect_timeout from an overallmaximum time limit into a per-host limit, but it didn't do a great job ofthat. The timer would only get restarted if we actually detected timeoutwithin connectDBComplete(), not if we changed our attention to a new hostfor some other reason. In that case the old timeout continued to run,possibly causing a premature timeout failure for the new host.Fix that, and also tweak the logic so that if we do get a timeout,we advance to the next available IP address, not to the next host name.There doesn't seem to be a good reason to assume that all the IPaddresses supplied for a given host name will necessarily fail thesame way as the current one. Moreover, this conforms better to theadmittedly-vague documentation statement that the timeout is "perconnection attempt". I changed that to "per host name or IP address"to be clearer. (Note that reconnections to the same server, such as forswitching protocol version or SSL status, don't get their own separatetimeout; that was true before and remains so.)Also clarify documentation about the interpretation of connect_timeoutvalues less than 2.This seems like a bug, so back-patch to v10 where this logic came in.Tom Lane, reviewed by Fabien CoelhoDiscussion:https://postgr.es/m/5735.1533828184@sss.pgh.pa.us1 parent246a6c8 commit1e6e98f
2 files changed
+27
-17
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1110 | 1110 |
| |
1111 | 1111 |
| |
1112 | 1112 |
| |
1113 |
| - | |
1114 |
| - | |
1115 |
| - | |
1116 |
| - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
1117 | 1118 |
| |
1118 | 1119 |
| |
1119 | 1120 |
| |
|
Lines changed: 22 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1905 | 1905 |
| |
1906 | 1906 |
| |
1907 | 1907 |
| |
| 1908 | + | |
| 1909 | + | |
1908 | 1910 |
| |
1909 | 1911 |
| |
1910 | 1912 |
| |
| |||
1918 | 1920 |
| |
1919 | 1921 |
| |
1920 | 1922 |
| |
1921 |
| - | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
1922 | 1926 |
| |
1923 | 1927 |
| |
1924 | 1928 |
| |
1925 |
| - | |
1926 |
| - | |
1927 | 1929 |
| |
1928 | 1930 |
| |
1929 | 1931 |
| |
1930 | 1932 |
| |
1931 | 1933 |
| |
1932 | 1934 |
| |
1933 | 1935 |
| |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
1934 | 1951 |
| |
1935 | 1952 |
| |
1936 | 1953 |
| |
| |||
1975 | 1992 |
| |
1976 | 1993 |
| |
1977 | 1994 |
| |
1978 |
| - | |
1979 |
| - | |
| 1995 | + | |
1980 | 1996 |
| |
1981 |
| - | |
1982 |
| - | |
| 1997 | + | |
1983 | 1998 |
| |
1984 |
| - | |
1985 |
| - | |
1986 |
| - | |
1987 |
| - | |
1988 |
| - | |
1989 |
| - | |
1990 | 1999 |
| |
1991 | 2000 |
| |
1992 | 2001 |
| |
|
0 commit comments
Comments
(0)