Re: Patch: Implement failover on libpq connect level.
Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: 'Mithun Cy' <mithun.cy@enterprisedb.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Peter van Hardenberg <pvh@pvh.ca>, Peter Eisentraut <peter_e@gmx.net>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-11-14T06:01:23Z
Lists: pgsql-hackers
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
Commits
-
libpq: Add target_session_attrs parameter.
- 721f7bd3cbcc 10.0 landed
-
Remove superuser checks in pgstattuple
- fd321a1dfd64 10.0 cited
-
Fix unwanted flushing of libpq's input buffer when socket EOF is seen.
- c405918858c0 9.6.0 cited