Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zvj1F-00075C-Tq for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2015 09:45:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zvj1F-0001SY-Fi for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2015 09:45:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zvizv-0008M3-Hd for pgsql-hackers@postgresql.org; Mon, 09 Nov 2015 09:44:23 +0000 Received: from wagner.pp.ru ([178.63.209.18] helo=mx.wagner.pp.ru) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Zvizs-0007R7-OY for pgsql-hackers@postgresql.org; Mon, 09 Nov 2015 09:44:23 +0000 Received: from mail.wagner.pp.ru (unknown [192.168.217.132]) by mx.wagner.pp.ru (Postfix) with ESMTP id 110054861A1 for ; Mon, 9 Nov 2015 12:44:14 +0300 (MSK) Received: from fafnir (newmail.postgrespro.ru [93.174.131.138]) by mail.wagner.pp.ru (Postfix) with ESMTPSA id 2804F20017 for ; Mon, 9 Nov 2015 12:44:05 +0300 (MSK) Date: Mon, 9 Nov 2015 12:44:04 +0300 From: Victor Wagner To: pgsql-hackers@postgresql.org Subject: Re: Patch: Implement failover on libpq connect level. Message-ID: <20151109124404.1af6ba0c@fafnir> In-Reply-To: References: <20150818041850.GA5092@wagner.pp.ru> <20151014104151.GA6744@wagner.pp.ru> <562E8C55.9030409@gmx.net> <20151028111839.6e73c68a@fafnir> <56327381.5040108@gmx.net> <56379A44.9080609@gmx.net> <20151105151235.GA21434@wagner.pp.ru> <20151106153807.GA6104@alvherre.pgsql> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Mon, 9 Nov 2015 15:14:02 +0800 Craig Ringer 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. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers