| From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | libpq async connection and multiple hosts |
| Date: | 2023-10-25 15:03:18 |
| Message-ID: | CA+mi_8YyGKA9dWELu63e=KL2oN-+Fe4uca4EtFfb6uQD4Up8pw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello,
We are aware that, using async connection functions (`PQconnectStart`,
`PQconnectPoll`), the `connect_timeout` parameter is not supported;
this is documented at
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNECTSTARTPARAMS
"""
The connect_timeout connection parameter is ignored when using
PQconnectPoll; it is the application's responsibility to decide
whether an excessive amount of time has elapsed. Otherwise,
PQconnectStart followed by a PQconnectPoll loop is equivalent to
PQconnectdb.
"""
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
Do we have to reimplement the connection attempts loop too?
Are there other policies that we would need to reimplement? Is
`target_session_attrs` taken care of by PQconnectPoll?
On my box (testing with psql and libpq itself),
PQconnect("host=8.8.8.8") fails after 2m10s. Is this the result of
some unspecified socket connection timeout on my Ubuntu machine?.
If we need to reimplement async connection to "host=X,Y", we will need
to use a timeout even if the user didn't specify one, otherwise we
will never stop the connection attempt to X and move to Y. What
timeout can we specify that will not upset anyone?
Thank you very much
-- Daniele
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Drouvot, Bertrand | 2023-10-25 15:19:54 | Re: Synchronizing slots from primary to standby |
| Previous Message | Nathan Bossart | 2023-10-25 14:50:00 | Re: [dynahash] do not refill the hashkey after hash_search |