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

Re: Patch: Implement failover on libpq connect level.

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Robert Haas' <robertmhaas(at)gmail(dot)com>, Mithun Cy<mithun(dot)cy(at)enterprisedb(dot)com>
Cc: 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-11-14 02:02:07
Message-ID: 0A3221C70F24FB45833433255569204D1F63FB5E@G01JPEXMBYT05 (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-jdbc
From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Robert Haas
> Great, committed.  There's still potentially more work to be done here,
> because my patch omits some features that were present in Victor's original
> submission, like setting the failover timeout, optionally randomizing the
> order of the hosts, and distinguishing between master and standby servers;
> Victor, or anyone, please feel free to submit separate patches for those
> things.

The attached patch fixes some bugs and make a clarification for doc.  Could you check and test the authentication stuff as I don't have an environment at hand?

(1) fe-connect.c
There was a memory leak.

(2) fe-secure_openssl.c, fe-auth.c
GSSAPI/SSPI/SSL authentication requires the target host name, but the code uses conn->pghost which contains a comma-separated list of host names.

(3) libpq.sgml
Added sentences to clarify connect_timeout when it is used with multiple hosts.

BTW, let me two questions.

Q1: Is there any reason why hostaddr doesn't accept multiple IP addresses?

Q2: pg_isready (and hence PQping() family) reports success when one host is alive and other hosts are down.  Is this intended?  I think this behavior is correct.
e.g. host1 is down and host2 is alive.
$ pg_isready -h host1,host2
host1,host2:5450 - accepting connections
$ echo $?

Takayuki Tsunakawa

Attachment: libpq-failover-smallbugs.patch
Description: application/octet-stream (5.7 KB)

In response to


pgsql-hackers by date

Next:From: Peter EisentrautDate: 2016-11-14 02:51:34
Subject: Re: sequences and pg_upgrade
Previous:From: Alvaro HerreraDate: 2016-11-14 01:35:51
Subject: Re: Physical append-only tables

pgsql-jdbc by date

Next:From: Tsunakawa, TakayukiDate: 2016-11-14 06:01:23
Subject: Re: Patch: Implement failover on libpq connect level.
Previous:From: Peter EisentrautDate: 2016-11-11 14:03:55
Subject: Re: Patch: Implement failover on libpq connect level.

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