Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch

Greg Sabino Mullane <htamfids@gmail.com>

From: Greg Sabino Mullane <htamfids@gmail.com>
To: Zsolt Parragi <zsolt.parragi@percona.com>
Cc: Evgeny Kuzin <evgeny.kuzin@outlook.com>, Jacob Champion <jacob.champion@enterprisedb.com>, Laurenz Albe <laurenz.albe@cybertec.at>, Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-12T21:43:00Z
Lists: pgsql-hackers
On Thu, Mar 12, 2026 at 5:22 PM Zsolt Parragi <zsolt.parragi@percona.com>
wrote:

> In a happy eyeballs analogy, one approach might want to connect to all
> listed IPs at the same time, and return the first that responds and is read
> write.
>

I would hope that "the first" read write is also "the only" read write. If
you have a multi-leader situation, you almost certainly want to be quite
precise about who connects to what, and not leave that up to the whims of
the network gods.

I'm still a big +1 to the original proposal in this thread, and don't think
it would be incompatible with happy eyeballs. Although I would think the
latter would be quite wasteful, as we are not simply checking for a
response, but doing a whole connect/authenticate/get-status dance. Is a
quicker response more important than querying every IP in the list every
time? I dunno. Maybe that's a future argument to target_session_attribs.[1]

[1] Yes, I know, but that's what the name should have been. Or even
"attributes"



Cheers,
Greg

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. libpq: Add target_session_attrs parameter.