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

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Evgeny Kuzin <evgeny(dot)kuzin(at)outlook(dot)com>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch
Date: 2026-03-12 21:43:00
Message-ID: CAKAnmm+uv24u3JuJuR8FO3POJeJDePS8B_A-vJ5RTrVCX4ikUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 12, 2026 at 5:22 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-03-12 21:45:20 Re: ALTER TABLE: warn when actions do not recurse to partitions
Previous Message Greg Burd 2026-03-12 21:31:47 Re: Expanding HOT updates for expression and partial indexes