Re: Proposal: Implement failover on libpq connect level. - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Proposal: Implement failover on libpq connect level.
Date
Msg-id CAA4eK1LY9Yz_3wUYtj-3+VaOZA6nsKKuroGCJmCmfQVCFvcQBA@mail.gmail.com
Whole thread Raw
In response to Proposal: Implement failover on libpq connect level.  (Victor Wagner <vitus@wagner.pp.ru>)
Responses Re: Proposal: Implement failover on libpq connect level.
List pgsql-hackers
On Tue, Aug 18, 2015 at 9:48 AM, Victor Wagner <vitus@wagner.pp.ru> wrote:

Behavoir
--------

If PQconnectdb encounters connect string with multiple hosts specified,
it attempts to establish connection with all these hosts simultaneously,
and begins to work with server which responds first, unless
loadbalancing parameter is true.


I think here you are mixing the behaviour for load balancing solution and
failover solution.  It seems to me that for client-side failover solution
(which is also known as Transparent Application Failover), the connection
attempt to second server should be done after the first connection is
broken as that provide more flexibility.
 
If the loadbalancing parameter is true, it tries servers sequentially in
the random order.

If the parameter readonly is false, after authenticating with server it
executes show transaction_read_only, to find out whether current
connection is to the master or to the hot standby, and connection is
considered successful only if server allows read write transactions.


Although both ideas (load balancing and failover) seems worth discussing,
they are separate features and can be worked on separately.  It will be
easier to sort out the details as well that way.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: checkpointer continuous flushing
Next
From: Craig Ringer
Date:
Subject: Re: More WITH