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
v28-0001-Add-PQconnCheck-and-PQcanConnCheck-to-libpq.patch
Description: v28-0001-Add-PQconnCheck-and-PQcanConnCheck-to-libpq.patch
v28-0002-postgres_fdw-add-postgres_fdw_verify_connection_.patch
Description: v28-0002-postgres_fdw-add-postgres_fdw_verify_connection_.patch
v28-0003-add-test.patch
Description: v28-0003-add-test.patch
v28-0004-add-kqueue-support-for-PQconnCheck-and-PQcanConn.patch
Description: v28-0004-add-kqueue-support-for-PQconnCheck-and-PQcanConn.patch