Re: Patch: Implement failover on libpq connect level.

Mithun Cy <mithun.cy@enterprisedb.com>

From: Mithun Cy <mithun.cy@enterprisedb.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Kuntal Ghosh <kuntalghosh.2007@gmail.com>, Catalin Iacob <iacobcatalin@gmail.com>, "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>, Craig Ringer <craig@2ndquadrant.com>, Peter van Hardenberg <pvh@pvh.ca>, Peter Eisentraut <peter_e@gmx.net>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-12-05T18:59:47Z
Lists: pgsql-hackers
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);

-- 
Thanks and Regards
Mithun C Y
EnterpriseDB: http://www.enterprisedb.com

Commits

  1. libpq: Add target_session_attrs parameter.

  2. Remove superuser checks in pgstattuple

  3. Fix unwanted flushing of libpq's input buffer when socket EOF is seen.