Re: [EXTERNAL] Re: Support load balancing in libpq
Jacob Champion <jchampion@timescale.com>
From: Jacob Champion <jchampion@timescale.com>
To: Maxim Orlov <orlovmg@gmail.com>
Cc: Jelte Fennema <Jelte.Fennema@microsoft.com>,
Michael Banck <mbanck@gmx.net>, Aleksander Alekseev <aleksander@timescale.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2023-01-12T23:19:19Z
Lists: pgsql-hackers
On Wed, Sep 14, 2022 at 7:54 AM Maxim Orlov <orlovmg@gmail.com> wrote: > For the patch itself, I think it is better to use a more precise time function in libpq_prng_init or call it only once. > Thought it is a special corner case, imagine all the connection attempts at first second will be seeded with the save > value, i.e. will attempt to connect to the same host. I think, this is not we want to achieve. Just a quick single-issue review, but I agree with Maxim that having one PRNG, seeded once, would be simpler -- with the tangible benefit that it would eliminate weird behavior on simultaneous connections when the client isn't using OpenSSL. (I'm guessing a simple lock on a global PRNG would be less overhead than the per-connection strong_random machinery, too, but I have no data to back that up.) The test seed could then be handled globally as well (envvar?) so that you don't have to introduce a debug-only option into the connection string. Overall, I like the concept. --Jacob
Commits
-
Fix pointer cast for seed calculation on 32-bit systems
- 2fe7a6df94e6 16.0 landed
-
Copy and store addrinfo in libpq-owned private memory
- 44d85ba5a336 16.0 landed
-
libpq: Use modern socket flags, if available.
- bfc9497ece01 16.0 cited