Skip site navigation (1) Skip section navigation (2)

Re: Patch: Implement failover on libpq connect level.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Catalin Iacob <iacobcatalin(at)gmail(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Peter van Hardenberg <pvh(at)pvh(dot)ca>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-12-05 17:53:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-jdbc
On Sun, Dec 4, 2016 at 11:00 PM, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com> wrote:
> On Fri, Dec 2, 2016 at 8:54 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> Couldn't this just be a variable in PQconnectPoll(), instead of adding
>> a new structure member?
> I have fixed same with a local variable in PQconnectPoll, Initally I thought
> savedMessage should have same visiblitly as errorMessage so we can restore
> the errorMessage even outside PQconnectPoll. But that seems not required.
> Attacting the new patch which fixes the same.

I think that you need a restoreErrorMessage call here:

                        /* Skip any remaining addresses for this host. */
                        conn->addr_cur = NULL;
                        if (conn->whichhost + 1 < conn->nconnhost)
                            conn->status = CONNECTION_NEEDED;
                            restoreErrorMessage(conn, &savedMessage);
                            goto keep_going;

Updated patch attached with that change, the removal of a useless
hunk, and the removal of "inline" from the new functions, which seems
like second-guessing of whatever decision the compiler chooses to


Robert Haas
The Enterprise PostgreSQL Company

Attachment: failover-to-new-master-bug-fix-03.patch
Description: text/x-patch (4.5 KB)

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2016-12-05 17:54:42
Subject: Re: Time to retire Windows XP buildfarm host?
Previous:From: Nico WilliamsDate: 2016-12-05 17:42:43
Subject: Re: Tackling JsonPath support

pgsql-jdbc by date

Next:From: Gavin FlowerDate: 2016-12-05 17:57:30
Subject: Re: Patch: Implement failover on libpq connect level.
Previous:From: Mithun CyDate: 2016-12-05 04:00:21
Subject: Re: Patch: Implement failover on libpq connect level.

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group