Re: [EXTERNAL] Re: Support load balancing in libpq

From: Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>
To: Michael Banck <mbanck(at)gmx(dot)net>
Cc: Maxim Orlov <orlovmg(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: Support load balancing in libpq
Date: 2023-01-09 13:00:01
Message-ID: DBBPR83MB05079A565E6AB609104D3F9DF7FE9@DBBPR83MB0507.EURPRD83.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Attached an updated patch which should address your feedback and
I updated the commit message.

> I wonder whether making the parameter a boolean will paint us into a
> corner

I made it a string option, just like target_session_attrs. I'm pretty sure a
round-robin load balancing policy could be implemented in the future
given certain constraints, like connections being made within the same
process. I adjusted the docs accordingly.

> > +typedef struct
> > +{
> > + int family;
> > + SockAddr addr;
> > +} AddrInfo;
>
> That last line looks weirdly indented compared to SockAddr; in the
> struct above.

Yes I agree, but for some reason pgindent really badly wants it formatted
that way. I now undid the changes made by pgindent manually.

> I wonder whether this needs to be documented if it is mostly a
> development/testing parameter?

I also wasn't sure whether it should be documented or not. I'm fine with
either, I'll leave it in for now and let a committer decide if it's wanted or not.

> A bit unclear why you put the variables at this point in the list, but
> the list doesn't seem to be ordered strictly anyway; still, maybe they
> would fit best at the bottom below target_session_attrs?

Good point, I added them after target_session_attrs now and also moved
docs/parsing accordingly. This makes conceptually to me as well, since
target_session_attrs and load_balance_hosts have some interesting
sense contextually too.

P.S. I also attached the same pgindent run patch that I added in
https://www.postgresql.org/message-id/flat/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529(at)AM5PR83MB0178(dot)EURPRD83(dot)prod(dot)outlook(dot)com

Attachment Content-Type Size
v6-0001-libpq-Run-pgindent-after-a9e9a9f32b3.patch application/octet-stream 39.3 KB
v6-0002-Support-load-balancing-in-libpq.patch application/octet-stream 28.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-01-09 13:00:26 Allow +group in pg_ident.conf
Previous Message Shinoda, Noriyoshi (PN Japan FSIP) 2023-01-09 12:44:12 RE: Perform streaming logical transactions by background workers and parallel apply