Enhance connecting process to backend.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 13 Jun 2025 01:08:12 +0000 (10:08 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 13 Jun 2025 01:08:12 +0000 (10:08 +0900)
commit445bfd17504f6315c68fad499188a589a0ed0a78
tree4e44e17b89408aa699e60794d836ff9c51878989
parent581173f5d4677bb624b9dd0faace202e9e1815b9
Enhance connecting process to backend.

In certain environment (especially k8s), DNS look up is unstable and
connecting to backend process fails.  This occurs in call to
getaddrinfo() in connect_inet_domain_socket_by_port(). To enhance the
situation, retry up to 5 times (at each retry, sleep 1 second) if
getaddrinfo() fails with EAI_AGAIN. Note that if
connect_inet_domain_socket_by_port() is called with "retry" argument
is false, the retry will not happen. Health check calls
connect_inet_domain_socket_by_port() with the retry flag to false so
that retrying is controlled health check's own parameters.

Since up to now there's no similar issue reported, back patch to only
4.6 to make backpatching minimal.

Discussion: https://github.com/pgpool/pgpool2/issues/104
Backpatch-through: v4.6
src/protocol/pool_connection_pool.c