RE: Timeout parameters

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: "Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>
Cc: "Jamison, Kirk" <k.jamison@jp.fujitsu.com>, "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>, 'Robert Haas' <robertmhaas@gmail.com>, "MikalaiKeida@ibagroup.eu" <MikalaiKeida@ibagroup.eu>, "AYahorau@ibagroup.eu" <AYahorau@ibagroup.eu>, Michael Paquier <michael@paquier.xyz>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-03-27T07:19:55Z
Lists: pgsql-hackers
Hello Ryohei-san,

About the backend v11 patch.

Patch applies cleanly, though compiles with a warning.
Make check ok, although the feature is not tested.

I'm okay with exposing this parameter.

Documentation:

ISTM this is not about libpq connections but about TCP connections. There 
can be non libpq implementations client side.

No space or newline before ";". Same comment about the libpq_ timeout.

If the parameter has no effect on Windows, I do not see why its value 
should be constrained to zero, it should just have no effect. Idem libpq_ 
timeout.

There is an error in the code, I think it should be < 0 to detect errors.

  pqcomm.c: In function ‘pq_settcpusertimeout’:
  pqcomm.c:1939:42: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
    if (setsockopt(port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (char *) &timeout, sizeof(timeout)) << 0 && errno != ENOPROTOOPT)
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~

The default postgres configuration file should be updated to reflect the 
parameter and its default value.

-- 
Fabien.

Commits

  1. Add support TCP user timeout in libpq and the backend server