Re: Patch: Implement failover on libpq connect level.

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Mithun Cy' <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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 06:01:23
Message-ID: 0A3221C70F24FB45833433255569204D1F63FD30@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Hi, Mithun

Before going deeper into the patch, let me give you some findings.

(1)
PGconn->target_server_type is not freed in freePGconn().

(2)
Could you add PGTARGETSERVERTYPE environment variable? Like other variables, it will ease testing, since users can change the behavior without altering the connection string here and there.

(3)
I think it would be better to expose the server state via ParameterStatus protocol message like standard_conforming_strings, instead of running "SELECT pg_is_in_recovery()". We shouldn't want to add one round trip to check the server type (master, standby). postmaster can return the server type based on its state (pmState); PM_RUN is master, and PM_HOT_STANDBY is standby. In addition, as an impractical concern, DBA can revoke EXECUTE privilege on pg_is_in_recovery() from non-superusers.

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-11-14 06:09:09 Re: Fix checkpoint skip logic on idle systems by tracking LSN progress
Previous Message Amit Langote 2016-11-14 05:16:32 Re: Declarative partitioning - another take

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mithun Cy 2016-11-14 07:38:41 Re: Patch: Implement failover on libpq connect level.
Previous Message Tsunakawa, Takayuki 2016-11-14 02:02:07 Re: Patch: Implement failover on libpq connect level.