Re: Add client connection check during the execution of the query

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
Cc: Maksim Milyutin <milyutinma@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Tatsuo Ishii <ishii@sraoss.co.jp>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Zhihong Yu <zyu@yugabyte.com>
Date: 2021-04-02T20:27:06Z
Lists: pgsql-hackers
On Fri, Apr 2, 2021 at 6:18 PM tsunakawa.takay@fujitsu.com
<tsunakawa.takay@fujitsu.com> wrote:
> The patch looks committable to me.

I checked for performance impact compared to master with pgbench -S,
and didn't see any problem.  I thought more about how to write a
decent race-free test but struggled with the lack of a good way to
control multiple connections from TAP tests and gave up for now.  I
previously tried to write something to help with that, but abandoned
it because it was terrible[1].  It seems a bit strange to me that psql
has to be involved at all, and we don't have a simple way to connect
one or more sockets and speak the protocol from perl.

Pushed!  Thanks to all who contributed.

[1] https://www.postgresql.org/message-id/CA%2BhUKG%2BFkUuDv-bcBns%3DZ_O-V9QGW0nWZNHOkEPxHZWjegRXvw%40mail.gmail.com,
see v2-0006-Add-TAP-test-for-snapshot-too-old.patch



Commits

  1. Add WL_SOCKET_CLOSED for socket shutdown events.

  2. Use WL_SOCKET_CLOSED for client_connection_check_interval.

  3. Detect POLLHUP/POLLRDHUP while running queries.

  4. Improve timeout.c's handling of repeated timeout set/cancel.