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

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: 2016-09-27 09:19:56
Message-ID: 20160927121956.2ab5138c@fafnir.local.vm (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-jdbc
On Sun, 25 Sep 2016 17:31:53 +0530
Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com> wrote:

> I have some more comments on libpq-failover-8.patch
> + /* FIXME need to check that port is numeric */
> Is this still applicable?.

Unfortunately, it was. I've fixed this problem in 9-th version of patch
> I think we need comments to know why we change default value based on
> number of elements in connection string. why default in not “any"
> when node count > 1.


> + /* loop over all the host specs in the node variable */
> + for (node = nodes; node->host != NULL || node->port != NULL; node++)
>   {
> I think instead of loop if we can move these code into a separate
> function say pg_add_to_addresslist(host, port, &addrs) this helps in
> removing temp variables like "struct node info” and several heap
> calls around it.

For some reason DNS resolving was concentrated in one place before my
changes. So, I've tried to not change this decision.

> 3)
> +static char *
> +get_port_from_addrinfo(struct addrinfo * ai)
> Need some comments for this function.

> We use strdup in many places no where we handle memory allocation
> failure.

Added some more memory allocation error checks.
> Comments not in sink with code.


Attachment: libpq-failover-9.patch
Description: text/x-patch (46.1 KB)

In response to


pgsql-hackers by date

Next:From: Masahiko SawadaDate: 2016-09-27 09:24:18
Subject: Re: Transactions involving multiple postgres foreign servers
Previous:From: Tom van TilburgDate: 2016-09-27 09:19:17
Subject: Re: inconsistent behaviour of set-returning functions in sub-query with random()

pgsql-jdbc by date

Next:From: Prasad VarakurDate: 2016-09-29 00:44:08
Subject: reg license implications in implementing/using the JDBC spec
Previous:From: Mithun CyDate: 2016-09-25 12:01:53
Subject: Re: Patch: Implement failover on libpq connect level.

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