<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 4, 2021 at 11:55 AM Dridi Boukelmoune <<a href="mailto:dridi@varni.sh">dridi@varni.sh</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
That still doesn't seal the can of worms: once there are more than one<br>
address per family or addresses change, it's our connection and<br>
pooling models that need to be revisited, how many different addresses<br>
to try connecting to, how to retry, and how we account for all of that<br>
(stats for example). Again, it's a bit more complex that just saying<br>
"change the connect callback to one that combines resolve+connect".<br></blockquote><div><br></div><div>I do understand that it's the core of the problem, and I'm probably being pig-headed on this, but it feels to me that it's not really different from a server with a floating IP, or a level-4 load-balancer fronting the backend. The addresses may change, there may be more than one, but once the connection is open, you can trust it and keep using it.</div><div>We trust connect() to get us to our goal, using getaddrinfo() on top of it just means that we trust the DNS server to provide good info. So:</div><div>- if we prefer IPv6, we go through the list and pick the first IPv6 entry, if we don't find one, we just grab the first IPv4 entry, no second chance<br></div><div>- if you try to reuse a connection and it died on you, you try to resolve+connect a new one. Maybe you get the same IP, maybe you don't, but we trust the DNS implementation to shuffle the entries around<br></div><div>- stats is an interesting issue, but again, only if you let it be. Backends are already "IP address" or "UDS path", I'm fine with hiding all the DNS entries behind "non-numerical host".</div><div><br></div><div>I agree, things get gnarly when we start fiddling with DNs, but there's that portable interface that allows us to not have to. And if you want fancy stuff like stats per IP, and fun load-balancing options that are DNS-aware, there are vmods for that.</div><div><br></div><div>For the sake of transparency, I must admit that I do have an issue with my proposal though: there's no timeout option for getaddrinfo, which sucks.<br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>-- <br></div><div>Guillaume Quintard</div></div></div></div> </div></div></div>