On 2/19/21 10:13 AM, Jan Wieck wrote:
Give the function, that postmaster is calling to accept a connection when a server_fd is ready, a return code that it can use to tell postmaster "forget about it, don't fork or do anything else with it". This function is normally calling StreamConnection() before the postmaster then forks the backend. But it could instead hand over the socket to the pool background worker (I presume Jonah is transferring them from process to process via UDP packet). The pool worker is then launching the actual backends which receive a requesting client via the same socket transfer to perform one or more transactions, then hand the socket back to the pool worker.
The function in question, which is StreamConnection() and with this patch can be replaced with an extension funtion via the fn_accept pointer, already has that capability. If StreamConnection() or its replacement returns a NULL pointer, the postmaster just skips calling BackendStartup(). So everything is already in place for the above to work.
Regards, Jan -- Jan Wieck Principle Database Engineer Amazon Web Services