Re: Patch: Implement failover on libpq connect level. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Patch: Implement failover on libpq connect level.
Date
Msg-id CA+TgmoZCq4Ee7dM8+8yELConeU4PSK84XC0KGGaoCXnYW0f7OQ@mail.gmail.com
Whole thread Raw
In response to Re: Patch: Implement failover on libpq connect level.  (Mithun Cy <mithun.cy@enterprisedb.com>)
List pgsql-hackers
On Mon, Dec 5, 2016 at 1:59 PM, Mithun Cy <mithun.cy@enterprisedb.com> wrote:
> On Mon, Dec 5, 2016 at 11:23 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>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;
>>                        }
>
> Right after seeing transaction is read-only we have restored the saved
> message so I think we do not need one more restore there.
>   if (strncmp(val, "on", 2) == 0)
>   {
>   PQclear(res);
> + restoreErrorMessage(conn, &savedMessage);

D'oh!  You're correct, of course.

Committed without that.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.