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
Message-ID: 6976633a-eaf7-bbc0-f471-0a2d7ad20e5f@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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!

[1]
https://www.postgresql.org/message-id/flat/20150818041850.GA5092%40wagner.pp.ru

--
Ildar Musin
i(dot)musin(at)postgrespro(dot)ru

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

Responses

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