pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Wagner <vitus@wagner.pp.ru>
To: pgsql-hackers@postgresql.org
Subject: Re: Patch: Implement failover on libpq connect level.
Date: Mon, 24 Oct 2016 14:09:57 +0300
Message-ID: <20161024140957.5249c361@fafnir.local.vm> (raw)
In-Reply-To: <CA+TgmoZHYhWai=+_y567xfj_d6Vm6T=grCo2LjFQMxZEBPVJjw@mail.gmail.com>
References: <56E0AD90.5090409@pgmasters.net>
	<CAD__Oui-3m6W83HyQNQLczrGRDQr4R67jv76DGwf1tT764zQ5A@mail.gmail.com>
	<CAD__OuhfOL-TQz-BBrFMj_tu8DqTc+ccxbwLkj+tUHAzvH14Pw@mail.gmail.com>
	<20160905072215.4efd7b8a@wagner.wagner.home>
	<20160905110311.GA11351@e733>
	<20160907165634.5f8e9675@fafnir.local.vm>
	<CAD__Oui5DGk1oJnhPNCd_+4WNKgJTb2ni44k3urxxO+s5esw2A@mail.gmail.com>
	<20160909114953.10e702e4@fafnir.local.vm>
	<CA+TgmoamO_XWL6hmLVGG0akHPGmq=KQ-6Ymgf6ZYt7R9V=xFhg@mail.gmail.com>
	<CAD__OujEj6mn_cw2DHqV+cXgrp5=dJvCsC3UBVYsGitmN0b2Zw@mail.gmail.com>
	<20160927121956.2ab5138c@fafnir.local.vm>
	<CAD__Ouj+Wwmsv0hGEhUqNg+7mmpZYkbF4TFWnGMqnd97N9bqkQ@mail.gmail.com>
	<20160930114451.68e0fade@fafnir.local.vm>
	<CAD__OuhtVs-jBtyHa-4ycpqsSxTSzp1NLKJ1nQ1gVMrUupi4og@mail.gmail.com>
	<20161013125358.607534ad@fafnir.local.vm>
	<CA+TgmoYJN9fU-f46spycngWtwGsSxb+66frH6KKG_RFNpR3EyQ@mail.gmail.com>
	<CA+TgmoZHYhWai=+_y567xfj_d6Vm6T=grCo2LjFQMxZEBPVJjw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Wed, 19 Oct 2016 20:15:38 -0400
Robert Haas <robertmhaas@gmail.com> wrote:

> 
> Some more comments:
> 
> - I am pretty doubtful that the changes to connectOptions2() work as
> intended.  I think that's only going to be called before actualhost
> and actualport could possibly get set.  I don't think we keep
> reinvoking this function for every new host we try.

I would investigate this. Probably test cases for .pgpass file should
be added.

 
> - It's pretty clear that this isn't going to work if the host list
> includes a mix of hostnames and UNIX socket addresses.  The code that
> handles the UNIX socket address case is totally separate from the code
> that handles the multiple-hostname case.

Muitihost feature was never intended to work with unix-domain socket. 
May be it should be clarified in the docs, or even improved error
message emitted when unix socket occurs in the multiple host list.
 
> - This creates a sort of definitional problem for functions like
> PQhost().  The documentation says of this and other related functions:
> "These values are fixed for the life of the PGconn object."  But with
> this patch, that would no longer be true.  So at least the
> documentation needs an update.  Actually, though, I think the problem

I've missed this phrase, documentation should be updated.

> is more fundamental than that.  If the user asks for PQhost(conn), do
> they want the list of all hosts, or the one to which we're currently
> connected?  It might be either, depending on what they intend to do
> with the information.  If they mean to construct a new connection
> string, they might well want them all; but something like psql's
> \conninfo only shows the current one.  There's also the question of
> what "the current one" means if we're not connected to any server at
> all.  I'm not sure exactly how to solve these problems, but they need
> some thought.

I've thought that no one would need to reconstruct connect string from
conninfo object.  May be I've missed some use cases. 

Name PQhost suggest that it'll return just one host. So, I've decided
to interpret it as  'currently choosen host'. 

If we really need function which lists all the potentially connected
hosts, it should be new function. 

I hope this would introduce no backward incompatibility, because no
existing setup uses multihost connect strings.

Thanks for your critique.

			Victor.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (165+ messages)  latest in thread

Message-ID: <20161024140957.5249c361@fafnir.local.vm>
Permalink:  ../20161024140957.5249c361@fafnir.local.vm/
Also on:    postgresql.org/message-id/20161024140957.5249c361@fafnir.local.vm

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: vitus@wagner.pp.ru, pgsql-hackers@postgresql.org
  Subject: Re: Patch: Implement failover on libpq connect level.
  In-Reply-To: <20161024140957.5249c361@fafnir.local.vm>
  References: <56E0AD90.5090409@pgmasters.net> <CAD__Oui-3m6W83HyQNQLczrGRDQr4R67jv76DGwf1tT764zQ5A@mail.gmail.com> <CAD__OuhfOL-TQz-BBrFMj_tu8DqTc+ccxbwLkj+tUHAzvH14Pw@mail.gmail.com> <20160905072215.4efd7b8a@wagner.wagner.home> <20160905110311.GA11351@e733> <20160907165634.5f8e9675@fafnir.local.vm> <CAD__Oui5DGk1oJnhPNCd_+4WNKgJTb2ni44k3urxxO+s5esw2A@mail.gmail.com> <20160909114953.10e702e4@fafnir.local.vm> <CA+TgmoamO_XWL6hmLVGG0akHPGmq=KQ-6Ymgf6ZYt7R9V=xFhg@mail.gmail.com> <CAD__OujEj6mn_cw2DHqV+cXgrp5=dJvCsC3UBVYsGitmN0b2Zw@mail.gmail.com> <20160927121956.2ab5138c@fafnir.local.vm> <CAD__Ouj+Wwmsv0hGEhUqNg+7mmpZYkbF4TFWnGMqnd97N9bqkQ@mail.gmail.com> <20160930114451.68e0fade@fafnir.local.vm> <CAD__OuhtVs-jBtyHa-4ycpqsSxTSzp1NLKJ1nQ1gVMrUupi4og@mail.gmail.com> <20161013125358.607534ad@fafnir.local.vm> <CA+TgmoYJN9fU-f46spycngWtwGsSxb+66frH6KKG_RFNpR3EyQ@mail.gmail.com> <CA+TgmoZHYhWai=+_y567xfj_d6Vm6T=grCo2LjFQMxZEBPVJjw@mail.gmail.com> <20161024140957.5249c361@fafnir.local.vm>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox