Re: libpq async connection and multiple hosts

Поиск
Список
Период
Сортировка
От Jelte Fennema
Тема Re: libpq async connection and multiple hosts
Дата
Msg-id CAGECzQSrSB2EL=vH53gpQFs=RVQZu7G341zxk3TYebVnZbNWuw@mail.gmail.com
обсуждение исходный текст
Ответ на libpq async connection and multiple hosts  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Ответы Re: libpq async connection and multiple hosts
Re: libpq async connection and multiple hosts
Список pgsql-hackers
On Wed, 25 Oct 2023 at 17:03, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> However, ISTM that connecting to multiple hosts is not supported
> either. I have a couple of issues I am looking into in psycopg 3:
>
> - https://github.com/psycopg/psycopg/issues/602
> - https://github.com/psycopg/psycopg/issues/674

Another approach is to use tcp_user_timeout instead of connect_timeout
to skip non-responsive hosts. It's not completely equivalent though to
connection_timeout though, since it also applies when the connection
is actually being used. Also it only works on Linux afaik. It could be
nice to add support for BSD its TCP_CONNECTIONTIMEOUT socket option.

> Do we have to reimplement the connection attempts loop too?

If you want to support connection_timeout, it seems yes.

> Are there other policies that we would need to reimplement? Is
> `target_session_attrs` taken care of by PQconnectPoll?

Afaict from the code target_session_attrs are handled inside
PQconnectPoll, so you would not have to re-implement that.
PQconnectPoll would simply fail if target_session_attrs don't match
for the server. You should implement load_balance_hosts=random though
by randomizing your hosts list.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: trying again to get incremental backup
Следующее
От: Andrei Zubkov
Дата:
Сообщение: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements