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: Andres Freund <andres@anarazel.de>
Cc: Maksim Milyutin <milyutinma@gmail.com>, "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>, Tatsuo Ishii <ishii@sraoss.co.jp>, Tom Lane <tgl@sss.pgh.pa.us>,
Zhihong Yu <zyu@yugabyte.com>
Date: 2022-01-14T06:30:07Z
Lists: pgsql-hackers
Attachments
- v7-0001-Add-WL_SOCKET_CLOSED-for-socket-shutdown-events.patch (text/x-patch) patch v7-0001
- v7-0002-Use-WL_SOCKET_CLOSED-for-client_connection_check_.patch (text/x-patch) patch v7-0002
On Fri, Jan 14, 2022 at 4:35 PM Andres Freund <andres@anarazel.de> wrote: > The more I think about it, the less I see why we *ever* need to re-arm the > latch in pq_check_connection() in this approach. pq_check_connection() is only > used from from ProcessInterrupts(), and there's plenty things inside > ProcessInterrupts() that can cause latches to be reset (e.g. parallel message > processing causing log messages to be sent to the client, causing network IO, > which obviously can do a latch reset). Thanks for the detailed explanation. I guess I was being overly cautious and a little myopic, "leave things exactly the way you found them", so I didn't have to think about any of that. I see now that the scenario I was worrying about would be a bug in whatever latch-wait loop happens to reach this code. Alright then, here is just... one... more... patch, this time consuming any latch that gets in the way and retrying, with no restore.
Commits
-
Add WL_SOCKET_CLOSED for socket shutdown events.
- 50e570a59e7f 15.0 landed
-
Use WL_SOCKET_CLOSED for client_connection_check_interval.
- cba5b994c990 15.0 landed
-
Detect POLLHUP/POLLRDHUP while running queries.
- c30f54ad732c 14.0 landed
-
Improve timeout.c's handling of repeated timeout set/cancel.
- 09cf1d522676 14.0 cited