Re: [HACKERS] [bug fix] PG10: libpq doesn't connect to alternativehosts when some errors occur - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject Re: [HACKERS] [bug fix] PG10: libpq doesn't connect to alternativehosts when some errors occur
Date
Msg-id 0A3221C70F24FB45833433255569204D1F6FADD3@G01JPEXMBYT05
Whole thread Raw
In response to Re: [HACKERS] [bug fix] PG10: libpq doesn't connect to alternativehosts when some errors occur  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: [HACKERS] [bug fix] PG10: libpq doesn't connect to alternativehosts when some errors occur  ("Tels" <nospam-pg-abuse@bloodgate.com>)
List pgsql-hackers
From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Michael Paquier
> On Thu, May 18, 2017 at 11:30 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> > Because why?
> 
> Because it is critical to let the user know as well *why* an error happened.
> Imagine that this feature is used with multiple nodes, all primaries. If
> a DB admin busted the credentials in one of them then all the load would
> be redirected on the other nodes, without knowing what is actually causing
> the error. Then the node where the credentials have been changed would just
> run idle, and the application would be unaware of that.

In that case, the DBA can know the authentication errors in the server log of the idle instance.

I'm sorry to repeat myself, but libpq connection failover is the feature for HA.  So I believe what to prioritize is
HA.

And the documentation looks somewhat misleading.  I get the impression that libpq tries hosts until success regardless
offailure reason: it aims for successful connection, not giving up early.  Who can read this as "libpq gives up
connectionunder some circumstances?"
 


https://www.postgresql.org/docs/devel/static/libpq-connect.html
--------------------------------------------------
It is possible to specify multiple host components, each with an optional port component, in a single URI. A URI of the
formpostgresql://host1:port1,host2:port2,host3:port3/ is equivalent to a connection string of the form
host=host1,host2,host3port=port1,port2,port3. Each host will be tried in turn until a connection is successfully
established.

...
If multiple host names are specified, each will be tried in turn in the order given.
--------------------------------------------------

Regards
Takayuki Tsunakawa


pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Get stuck when dropping a subscription duringsynchronizing table