Re: Patch: Implement failover on libpq connect level. - Mailing list pgsql-hackers

From Mithun Cy
Subject Re: Patch: Implement failover on libpq connect level.
Date
Msg-id CAD__Oui5DGk1oJnhPNCd_+4WNKgJTb2ni44k3urxxO+s5esw2A@mail.gmail.com
Whole thread Raw
In response to Re: Patch: Implement failover on libpq connect level.  (Victor Wagner <vitus@wagner.pp.ru>)
Responses Re: Patch: Implement failover on libpq connect level.  (Victor Wagner <vitus@wagner.pp.ru>)
List pgsql-hackers

On Wed, Sep 7, 2016 at 7:26 PM, Victor Wagner <vitus@wagner.pp.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

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [sqlsmith] Failed assertion in joinrels.c
Next
From: Vik Fearing
Date:
Subject: Re: Quorum commit for multiple synchronous replication.