Re: hostorder and failover_timeout for libpq

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ildar Musin <ildar(at)adeven(dot)com>
Cc: surafel3000(at)gmail(dot)com, i(dot)musin(at)postgrespro(dot)ru, pgsql-hackers(at)postgresql(dot)org, v(dot)wagner(at)postgrespro(dot)ru
Subject: Re: hostorder and failover_timeout for libpq
Date: 2018-10-01 07:10:20
Message-ID: 20181001071020.GI11712@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 19, 2018 at 02:26:53PM +0200, Ildar Musin wrote:
> Another approach would be to leave `pg_conn->connhost` as it is now (i.e.
> not to create global addresses array) and just apply random permutations to
> it if `hostorder=random` is specified. And probably apply permutations to
> addresses list within each individual host.
>
> At this point I'd like to ask community what in your opinion would be the
> best course of action and whether this feature should be implemented within
> libpq at all? Because from my POV there are factors that really depend on
> network architecture and there is probably no single right solution.

As things stand now, when multiple hosts are defined in a connection
string the order specified in the string is used until a successful
connection is done. When working on Postgres-XC, we have implemented
similar capability at application-level. However, now that libpq also
supports multi-host capabilities, I could see a point in having
something within libpq. What could we get though except a random mode
for read-only or read-write load balancing? This only use case looks a
bit limited to me to rework again the code paths discarding the
connection failures for that though, as there is as well the argument to
tell the application to generate its own connection string based on
libpq properties. So my take would be to just do that at
application-level and not bother.

By the way, I can see that the latest patch available does not apply at
tries to juggle with multiple concepts. I can see at least two of them:
failover_timeout and hostorder. You should split things. I have moved
the patch to next CF, waiting on author.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-10-01 07:15:42 Re: Hash Joins vs. Bloom Filters / take 2
Previous Message Michael Paquier 2018-10-01 06:54:06 Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager