Re: Patch: Implement failover on libpq connect level.

From: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2015-12-10 04:54:19
Message-ID: 20151210075419.6c9b7ca4@wagnner.wagner.home
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackerspgsql-jdbc

On Mon, 07 Dec 2015 15:26:33 -0500
Korry Douglas <korry(dot)douglas(at)enterprisedb(dot)com> 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.

--
Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>

Attachment Content-Type Size
libpq-failover-5.patch text/x-patch 35.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2015-12-10 05:00:36 Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()
Previous Message Amit Langote 2015-12-10 04:41:20 Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()

Browse pgsql-jdbc by date

  From Date Subject
Next Message Corradini, Carlos 2015-12-10 13:38:10 [JDBC] plpgsql function with RETURNS SETOF refcursor in JAVA
Previous Message Jeremy Whiting 2015-12-08 17:58:51 Re: JDBC 9.4 1205 released