Re: Patch: Implement failover on libpq connect level.
Victor Wagner <vitus@wagner.pp.ru>
From: Victor Wagner <vitus@wagner.pp.ru>
To: pgsql-hackers@postgresql.org
Date: 2016-09-06T05:03:49Z
Lists: pgsql-hackers
On Tue, 6 Sep 2016 07:58:28 +0530
Mithun Cy <mithun.cy@enterprisedb.com> wrote:
>
> Now if only one host is in connection string and it ask for read_write
> connection(connect to master) I mean read_only is set 0 explicitly.
> With above logic we will allow it to connect to standby?. I still
> think psql connection to standby should be handled by changing the
> default value of readonly to 1 (which means connect to any).
It would definitely be more logical, but I haven't found easy way to do
it. May be I should return to this place and rethink. I don't like and
idea to explicitely ignore connection string parameter due to some
condition.
Really, I think, test for replication connection can be either
removed from this part of code now.
> Thinking
> further probably replacing readonly parameter with
> targetServerType=any|master (with default being any) should clear
> some confusions and bring consistency since same is used in JDBC
> multi host connection string.
It seems that in this context change readonly=0|1 to
targetServerType=any|master makes sense.
> 2)
> @@ -1460,33 +1538,80 @@ connectDBStart(PGconn *conn)
> portstr,
> (int) (UNIXSOCK_PATH_BUFLEN - 1));
> conn->options_valid = false;
> + free(nodes->port);
>
> nodes->port was not allocated at this point.
>
I'll recheck it.
--
Victor Wagner <vitus@wagner.pp.ru>
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