Re: [doc fix] PG10: wroing description on connect_timeout when multiple hosts are specified

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Robert Haas (robertmhaas(at)gmail(dot)com)" <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [doc fix] PG10: wroing description on connect_timeout when multiple hosts are specified
Date: 2017-05-15 01:05:29
Message-ID: 0A3221C70F24FB45833433255569204D1F6F836E@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tsunakawa,> Takayuki
> Instead, I think we should fix the program to match the documented behavior.
> Otherwise, if the first database machine is down, libpq might wait for about
> 2 hours (depending on the OS's TCP keepalive setting), during which it tims
> out after connect_timeout and does not attempt to connect to other hosts.
>
> I'll add this item in the PostgreSQL 10 Open Items.

Please use the attached patch to fix the problem. I confirmed the success as follows:

$ add "post_auth_delay = 10" in postgresql.conf on host1
$ start database servers on host1 and host2
$ psql -h host1,host2 -p 5432,5433 -d "dbname=postgres connect_timeout=3"
(psql connected to host2 after 3 seconds, which I checked with \conninfo)

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
libpq-connect-retry-on-timeout.txt text/plain 3.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-05-15 01:19:58 Re: [bug fix] PG10: libpq doesn't connect to alternative hosts when some errors occur
Previous Message Peter Geoghegan 2017-05-15 00:05:24 Re: Hash Functions