Re: libpq async connection and multiple hosts - Mailing list pgsql-hackers

From Daniele Varrazzo
Subject Re: libpq async connection and multiple hosts
Date
Msg-id CA+mi_8bOcddzUTiLrLQD8ZXvRRnaNU1Z9iOSJCcrRuyYTWGOHw@mail.gmail.com
Whole thread Raw
In response to Re: libpq async connection and multiple hosts  (Jelte Fennema <postgres@jeltef.nl>)
Responses Re: libpq async connection and multiple hosts
List pgsql-hackers
On Thu, 26 Oct 2023, 00:10 Jelte Fennema, <postgres@jeltef.nl> wrote:
On Wed, 25 Oct 2023 at 18:54, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> - connect_timeout
> - multiple host, hostaddr, port
> - load_balance_hosts=random
>
> Does this list sound complete?

I think you'd also want to resolve the hostnames to IPs yourself and
iterate over those one-by-one. Otherwise if the first IP returned for
the hostname times out, you will never connect to the others.

For async connections we were already unpacking and processing the hosts list, in order to perform non-blocking resolution and populate the hostaddr. This already accounted for the possibility of one host resolving to more than one address. But then we would have packed everything back into a single conninfo and made a single connection attempt.


The goal here was only non-blocking name resolution. Ahaini understand we should do is to split on the hosts for sync connections too, shuffle if requested, and make separate  connection attempts.

-- Daniele

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Should we represent temp files as unsigned long int instead of signed long int type?
Next
From: Bruce Momjian
Date:
Subject: Re: Document aggregate functions better w.r.t. ORDER BY