On Monday, February 25, 2019 1:49 PM (GMT+9), Nagaura, Ryohei wrote:
> Thank you for discussion.
> I made documentation about socket_timeout and reflected Tsunakawa-san's
> comment in the new patch.
> # Mainly only fixing documentation...
> The current documentation of socket_timeout is as follows:
> socket_timeout
> Controls the number of second of client's waiting time for individual socket
> read/write operations. This can be used both as a force global query timeout
> and network problems detector. A value of zero (the default) turns this off.
Thanks for the update.
However, your socket_timeout patch currently does not apply.
$ git apply ../socket_timeout_v5.patch
fatal: corrupt patch at line 24
--> l24: diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
>socket_timeout
>
> Controls the number of second of client's waiting time for individual socket read/write
> operations. This can be used both as a force global query timeout and network problems
> detector. A value of zero (the default) turns this off.
Got the doc fix. I wonder if we need to document what effect the parameter does:
terminating the connection. How about:
Controls the number of seconds of client-server communication inactivity
before forcibly closing the connection in order to prevent client from
infinite waiting for individual socket read/write operations. This can
be used both as a force global query timeout and network problems
detector, i.e. hardware failure and dead connection. A value of zero
(the default) turns this off.
Well, you may remove the "i.e. hardware failure and dead connection" if
that's not necessary.
I know you've only added the doc recommendation.
But regarding the code, you may also fix other parts:
a. Use parse_int_param instead of atoi
>+ conn->socket_timeout = atoi(conn->pgsocket_timeout);
b. proper spacing after comma
>+ {"socket_timeout", NULL, NULL, NULL,
>+ "Socket-timeout","",10, /* strlen(INT32_MAX) == 10 */
>+ offsetof(struct pg_conn, pgsocket_timeout)},
...
>+ result = pqSocketCheck(conn,forRead,forWrite,finish_time);
There are probably other parts I missed.
Regards,
Kirk Jamison