RE: [Proposal] Add foreign-server health checks infrastructure
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, 'Katsuragi Yuta' <katsuragiy@oss.nttdata.com>
Cc: 'Ted Yu' <yuzhihong@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, vignesh C <vignesh21@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Önder Kalacı <onderkalaci@gmail.com>, Fujii Masao <masao.fujii@oss.nttdata.com>, "Shinya11.Kato@oss.nttdata.com" <Shinya11.Kato@oss.nttdata.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2023-01-27T03:50:18Z
Lists: pgsql-hackers
Attachments
- v28-0001-Add-PQconnCheck-and-PQcanConnCheck-to-libpq.patch (application/octet-stream) patch v28-0001
- v28-0002-postgres_fdw-add-postgres_fdw_verify_connection_.patch (application/octet-stream) patch v28-0002
- v28-0003-add-test.patch (application/octet-stream) patch v28-0003
- v28-0004-add-kqueue-support-for-PQconnCheck-and-PQcanConn.patch (application/octet-stream) patch v28-0004
Dear hackers, I have updated my patch for error handling and kqueue() support. Actually I do not have BSD-like machine, but I developed by using github CICD. I think at first we should focus on 0001-0003, and then work for 0004. Followings are change notes and my analysis. 0001 * Fix missed replacements from PQConnCheck() to PQconnCheck(). * Error handling was improved. Now we can detect the failure of poll() and return -1 at that time. * I thought we don't have to add select(2) in PQconnCheck(). According to man page [1], select(2) can be only used for watch whether the status is readable, writable, or exceptional condition. It means that select() does not have an event corresponding to POLLRDHUP. 0002, 0003 Not changed 0004 * Add kqueue(2) support() for BSD family. * I did not add epoll() support, because it can be used only on linux and such systems have POLLRDHUP instead. checked other codes in libpq, and they do not use epoll(). We can see that such an event does not specified in POSIX [2] and it can be used for linux only. I decided to use poll() as much as possible to keep the policy. * While coding, I found that there are no good timing to close the kernel event queue. It means that the lifetime of kqueue becomes same as the client program and occupy the small memory forever. I'm not sure it can be accepted. [1]: https://man7.org/linux/man-pages/man2/select.2.html [2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html Best Regards, Hayato Kuroda FUJITSU LIMITED
Commits
-
postgres_fdw: Extend postgres_fdw_get_connections to return user name.
- 4f08ab554577 18.0 landed
-
postgres_fdw: Fix bug in connection status check.
- 454aab4b738e 18.0 landed
-
postgres_fdw: Add connection status check to postgres_fdw_get_connections().
- 857df3cef7be 18.0 landed
-
postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections().
- c297a47c5f8d 18.0 landed
-
doc: Enhance documentation for postgres_fdw_get_connections() output columns.
- 284c030a10b8 18.0 landed
-
Avoid reference to nonexistent array element in ExecInitAgg().
- 92957ed98c5c 16.0 cited
-
Add WL_SOCKET_CLOSED for socket shutdown events.
- 50e570a59e7f 15.0 cited
-
postgres_fdw: reestablish new connection if cached one is detected as broken.
- 32a9c0bdf493 14.0 cited