Re: Patch: Implement failover on libpq connect level.

From: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2015-11-09 09:44:04
Message-ID: 20151109124404.1af6ba0c@fafnir
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Mon, 9 Nov 2015 15:14:02 +0800
Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:

>
> I'd rather not see convoluted and complex connstrings, per my prior
> post. The JDBC extended URL style seems good enough.

It is what my patch implements.

> IMO the biggest problem is that client-side failover is way more
> complex than "got -ECONNREFUSED, try next host". I think we're all
> focusing on not being able to twiddle arbitrary settings while
> ignoring the real problem with client failover, i.e. making it
> actually work in the real world.
>
I've tried to deal with some of these problems.

My patch have support for following things:

1. Check whether database instance is in the recovery/standby mode and
try to find another one if so.
2. Let cluster management software to have some time to promote one of
the standbys to master. I.e. there can be failover timeout specified to
allow retry after some time if no working master found.

Really there is room for some improvements in handling of connect
timeout (which became much more important thing when ability to try
next host appears). Now it is handled only by blocking-mode connect
functions, not by async state machine. But I decided to publish patch
without these improvements to get feedback from community.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2015-11-09 10:01:52 Re: Transactions involving multiple postgres foreign servers
Previous Message Etsuro Fujita 2015-11-09 09:40:45 Re: Foreign join pushdown vs EvalPlanQual

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chapman Flack 2015-11-10 00:17:37 Re: more re: possible pljava / pgjdbc / pgjdbc-ng code sharing
Previous Message Craig Ringer 2015-11-09 07:14:02 Re: Patch: Implement failover on libpq connect level.