Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aB1Jn-0000G1-CU for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2015 14:20:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aB1Jm-0007iH-Cp for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2015 14:20:06 +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 1aB1IQ-0005MU-Io for pgsql-hackers@postgresql.org; Mon, 21 Dec 2015 14:18:42 +0000 Received: from hook.sigaev.ru ([93.180.27.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aB1IM-0001f9-GT for pgsql-hackers@postgresql.org; Mon, 21 Dec 2015 14:18:41 +0000 Received: from xor.sai.msu.ru (newmail.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: teodor) by hook.sigaev.ru (Postfix) with ESMTPSA id 78B10B1918A; Mon, 21 Dec 2015 17:18:37 +0300 (MSK) Subject: Re: Patch: Implement failover on libpq connect level. To: Victor Wagner , pgsql-hackers@postgresql.org 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> <20151109124404.1af6ba0c@fafnir> <5665EB79.9070805@enterprisedb.com> <20151210075419.6c9b7ca4@wagnner.wagner.home> From: Teodor Sigaev Message-ID: <56780A3D.2090609@sigaev.ru> Date: Mon, 21 Dec 2015 17:18:37 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 MIME-Version: 1.0 In-Reply-To: <20151210075419.6c9b7ca4@wagnner.wagner.home> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 Sorry, but there is something wrong with your patch: % patch -p1 -C < ~/Downloads/libpq-failover-5.patch .... -------------------------- |diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c ... Hunk #18 succeeded at 2804. patch: **** malformed patch at line 666: <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<< Victor Wagner wrote: > On Mon, 07 Dec 2015 15:26:33 -0500 > Korry Douglas wrote: > > >> The problem seems to be in PQconnectPoll() in the case for >> CONNECTION_AUTH_OK, specifically this code: >> >> /* We can release the address list now. */ >> pg_freeaddrinfo_all(conn->addrlist_family, conn->addrlist); >> conn->addrlist = NULL; >> conn->addr_cur = NULL; >> That frees up the list of alternative host addresses. The state >> machine then progresses to CONNECTION_CHECK_RO (which invokes >> pg_is_in_recovery()), then CONNECTION_CHECK_RW (waiting for the > > Thank you for pointing to this problem. I've overlooked it. Probably > I should improve my testing scenario. > > I', attaching new version of the patch, which, hopefully, handles > address list freeing correctly. > > > > > > > -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers