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
Views: Raw Message | Whole Thread | Download mbox
Thread:
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
(attached)
>
> 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.

Fixed.

>
> + /* 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.

Done.

> 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.

Fixed.

Attachment Content-Type Size
libpq-failover-9.patch text/x-patch 46.1 KB

In response to

Responses

Browse pgsql-hackers by date

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

Browse pgsql-jdbc by date

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