Re: Patch: Implement failover on libpq connect level.
Aleksander Alekseev <a.alekseev@postgrespro.ru>
From: Aleksander Alekseev <a.alekseev@postgrespro.ru>
To: Victor Wagner <vitus@wagner.pp.ru>
Cc: pgsql-hackers@postgresql.org
Date: 2016-09-07T14:32:11Z
Lists: pgsql-hackers
> > 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? :) -- Best regards, Aleksander Alekseev
Commits
-
libpq: Add target_session_attrs parameter.
- 721f7bd3cbcc 10.0 landed
-
Remove superuser checks in pgstattuple
- fd321a1dfd64 10.0 cited
-
Fix unwanted flushing of libpq's input buffer when socket EOF is seen.
- c405918858c0 9.6.0 cited