Re: Patch: Implement failover on libpq connect level.
Victor Wagner <vitus@wagner.pp.ru>
From: Victor Wagner <vitus@wagner.pp.ru>
To: pgsql-hackers@postgresql.org
Date: 2015-11-09T09:44:04Z
Lists: pgsql-hackers
On Mon, 9 Nov 2015 15:14:02 +0800 Craig Ringer <craig@2ndquadrant.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.
Commits
-
libpq: Add target_session_attrs parameter.
- 721f7bd3cbcc 10.0 landed
-
Remove superuser checks in pgstattuple
- fd321a1dfd64 10.0 cited
-
Fix unwanted flushing of libpq's input buffer when socket EOF is seen.
- c405918858c0 9.6.0 cited