Re: Patch: Implement failover on libpq connect level.

From: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-09-06 05:03:49
Message-ID: 20160906080349.0a7dcf69@wagner.wagner.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Tue, 6 Sep 2016 07:58:28 +0530
Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)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(at)wagner(dot)pp(dot)ru>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2016-09-06 05:18:15 Re: Proposal for changes to recovery.conf API
Previous Message Craig Ringer 2016-09-06 04:54:31 Re: patch: function xmltable

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2016-09-07 09:09:38 Re: 9.4.1210 release
Previous Message Mithun Cy 2016-09-06 02:28:28 Re: Patch: Implement failover on libpq connect level.