hostorder and failover_timeout for libpq

From: Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Victor Wagner <v(dot)wagner(at)postgrespro(dot)ru>
Subject: hostorder and failover_timeout for libpq
Date: 2018-04-18 11:34:12
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello hackers,

Couple of years ago Victor Wagner presented a patch [1] that introduced
multiple hosts capability and also hostorder and failover_timeout
parameters for libpq. Subsequently multi-host feature was reimplemented
by Robert Haas and committed. Later target_session_attrs parameter was
also added. In this thread I want to revisit hostorder and
failover_timeout proposal.

'hostorder' defines the order in which postgres instances listed in
connection string will be tried. Possible values are:
* sequential (default)
* random

Random order can be used, for instance, for maintaining load balancing
(which is particularly useful in multi-master cluster, but also can be
used to load-balance read-only connections to standbys).

'failover_timeout' specifies time span (in seconds) during which libpq
would continue attempts to connect to the hosts listed in connection
string. If failover_timeout is specified then libpq will loop over hosts
again and again until either it successfully connects to one of the
hosts or it runs out of time.

I reimplemented 'hostorder' and 'failover_timeout' parameters in the
attached patch. I also took some documentation pieces from Victor
Wagner's original patch. I'll be glad to see any comments and
suggestions. Thanks!


Ildar Musin

Attachment Content-Type Size
hostorder_v1.patch text/x-diff 27.4 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-04-18 11:37:11 Re: [HACKERS] proposal: schema variables
Previous Message Pavan Deolasee 2018-04-18 10:49:12 Re: VM map freeze corruption