Re: Patch: Implement failover on libpq connect level.

From: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
To: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-09-09 05:50:59
Message-ID: CAD__Oui5DGk1oJnhPNCd_+4WNKgJTb2ni44k3urxxO+s5esw2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Wed, Sep 7, 2016 at 7:26 PM, Victor Wagner <vitus(at)wagner(dot)pp(dot)ru> wrote:
> No, algorithm here is more complicated. It must ensure that there would
> not be second attempt to connect to host, for which unsuccessful
> connection attempt was done. So, there is list rearrangement.
>Algorithm for pick random list element by single pass is quite trivial.

If concern is only about excluding address which was tried previously. Then
I think we can try this way, randomly permute given address list (for
example fisher-yates shuffle) before trying any of those address in it.
After that you can treat the new list exactly like we do for sequential
connections. I think this makes code less complex.
--
Thanks and Regards
Mithun C Y
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2016-09-09 06:23:06 Re: Quorum commit for multiple synchronous replication.
Previous Message Dilip Kumar 2016-09-09 04:49:05 Re: [sqlsmith] Failed assertion in joinrels.c

Browse pgsql-jdbc by date

  From Date Subject
Next Message Victor Wagner 2016-09-09 08:49:53 Re: Patch: Implement failover on libpq connect level.
Previous Message Aleksander Alekseev 2016-09-08 14:48:25 Re: Patch: Implement failover on libpq connect level.