|From:||Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>|
|To:||Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>|
|Subject:||Re: Patch: Implement failover on libpq connect level.|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
> > 8) get_next_element procedure implementation is way too smart (read
> > "complicated"). You could probably just store current list length and
> > generate a random number between 0 and length-1.
> 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.
Great! In this case I would be _trivial_ for you to write a comment that
describes how this procedure works, what makes you think that it gives a
good distribution in all possible cases (e.g. if there is more than
0x10000 elements in a list - why not), etc. Right? :)
|Next Message||Yury Zhuravlev||2016-09-07 14:34:12||Re: Suggestions for first contribution?|
|Previous Message||Aleksander Alekseev||2016-09-07 14:14:44||Re: Suggestions for first contribution?|
|Next Message||Victor Wagner||2016-09-08 11:24:20||Re: Patch: Implement failover on libpq connect level.|
|Previous Message||Victor Wagner||2016-09-07 13:56:34||Re: Patch: Implement failover on libpq connect level.|