Detect POLLHUP/POLLRDHUP while running queries.
Thomas Munro <tmunro@postgresql.org>
Detect POLLHUP/POLLRDHUP while running queries. Provide a new GUC check_client_connection_interval that can be used to check whether the client connection has gone away, while running very long queries. It is disabled by default. For now this uses a non-standard Linux extension (also adopted by at least one other OS). POLLRDHUP is not defined by POSIX, and other OSes don't have a reliable way to know if a connection was closed without actually trying to read or write. In future we might consider trying to send a no-op/heartbeat message instead, but that could require protocol changes. Author: Sergey Cherkashin <s.cherkashin@postgrespro.ru> Author: Thomas Munro <thomas.munro@gmail.com> Reviewed-by: Thomas Munro <thomas.munro@gmail.com> Reviewed-by: Tatsuo Ishii <ishii@sraoss.co.jp> Reviewed-by: Konstantin Knizhnik <k.knizhnik@postgrespro.ru> Reviewed-by: Zhihong Yu <zyu@yugabyte.com> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Maksim Milyutin <milyutinma@gmail.com> Reviewed-by: Tsunakawa, Takayuki/綱川 貴之 <tsunakawa.takay@fujitsu.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (much earlier version) Discussion: https://postgr.es/m/77def86b27e41f0efcba411460e929ae%40postgrespro.ru
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/config.sgml | modified | +37 −0 |
| src/backend/libpq/pqcomm.c | modified | +40 −0 |
| src/backend/tcop/postgres.c | modified | +32 −0 |
| src/backend/utils/init/globals.c | modified | +1 −0 |
| src/backend/utils/init/postinit.c | modified | +10 −0 |
| src/backend/utils/misc/guc.c | modified | +29 −0 |
| src/backend/utils/misc/postgresql.conf.sample | modified | +3 −0 |
| src/include/libpq/libpq.h | modified | +1 −0 |
| src/include/miscadmin.h | modified | +1 −0 |
| src/include/tcop/tcopprot.h | modified | +1 −0 |
| src/include/utils/timeout.h | modified | +1 −0 |
Documentation touched
Discussion
- Add client connection check during the execution of the query 54 messages · 2018-11-19 → 2022-02-14