Re: Proposal: Implement failover on libpq connect level.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Implement failover on libpq connect level.
Date: 2015-08-19 02:58:32
Message-ID: CAA4eK1LY9Yz_3wUYtj-3+VaOZA6nsKKuroGCJmCmfQVCFvcQBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Tue, Aug 18, 2015 at 9:48 AM, Victor Wagner <vitus(at)wagner(dot)pp(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2015-08-19 02:58:56 Re: More WITH
Previous Message Amit Kapila 2015-08-19 02:36:35 Re: checkpointer continuous flushing

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tatsuo Ishii 2015-08-19 03:42:45 Re: Proposal: Implement failover on libpq connect level.
Previous Message Dave Cramer 2015-08-19 01:56:55 Re: sql type reported for enum