Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch - Mailing list pgsql-hackers

From Greg Sabino Mullane
Subject Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch
Date
Msg-id CAKAnmm+uv24u3JuJuR8FO3POJeJDePS8B_A-vJ5RTrVCX4ikUQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch  (Zsolt Parragi <zsolt.parragi@percona.com>)
List 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

pgsql-hackers by date:

Previous
From: "Greg Burd"
Date:
Subject: Re: Expanding HOT updates for expression and partial indexes
Next
From: Zsolt Parragi
Date:
Subject: Re: ALTER TABLE: warn when actions do not recurse to partitions