RE: Timeout parameters
Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: "Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>
Cc: "Jamison, Kirk" <k.jamison@jp.fujitsu.com>, 'Kyotaro HORIGUCHI' <horiguchi.kyotaro@lab.ntt.co.jp>, "coelho@cri.ensmp.fr" <coelho@cri.ensmp.fr>, "robertmhaas@gmail.com" <robertmhaas@gmail.com>, "MikalaiKeida@ibagroup.eu" <MikalaiKeida@ibagroup.eu>, "AYahorau@ibagroup.eu" <AYahorau@ibagroup.eu>, "michael@paquier.xyz" <michael@paquier.xyz>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-03-29T03:36:45Z
Lists: pgsql-hackers
Nagaura-san,
The socket_timeout patch needs the following fixes. Now that others have already tested these patches successfully, they appear committable to me.
(1)
+ else
+ goto iiv_error;
...
+
+iiv_error:
+ conn->status = CONNECTION_BAD;
+ printfPQExpBuffer(&conn->errorMessage,
+ libpq_gettext("invalid integer value for socket_timeout\n"));
+ return false;
This goto and its corresponding iiv_error label are redundant. You can just set the error message and return at the call site of parse_int_param(). i.e.:
if (!parse_int_param(...))
{
error processing
return false;
}
if(conn->socket_timeout > 0 && conn->socket_timeout < 2)
conn->socket_timeout = 2;
The reason why oom_error label is present is that it is used at multiple places to avoid repeating the same error processing code.
(2)
+ conn->sock = -1;
Use PGINVALID_SOCKET instead of -1.
Regards
Takayuki Tsunakawa
Commits
-
Add support TCP user timeout in libpq and the backend server
- 249d64999615 12.0 landed