Add Option To Check All Addresses For Matching target_session_attr
Andrew Jackson <andrewjackson947@gmail.com>
From: Andrew Jackson <andrewjackson947@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2024-11-20T15:51:12Z
Lists: pgsql-hackers
Attachments
- postgres.patch (text/x-patch) patch
Hi, I was attempting to set up a high availability system using DNS and target_session_attrs. I was using a DNS setup similar to below and was trying to use the connection strings `psql postgresql:// user@pg.database.com/db_name?target_session=read-write` to have clients dynamically connect to the primary or `psql postgresql:// user@pg.database.com/db_name?target_session=read-only` to have clients connect to a read replica. The problem that I found with this setup is that if libpq is unable to get a matching target_session_attr on the first connection attempt it does not consider any further addresses for the given host. This patch is designed to provide an option that allows libpq to look at additional addresses for a given host if the target_session_attr check fails for previous addresses. Would appreciate any feedback on the applicability/relevancy of the goal here or the implementation. Example DNS setup ________________________________ Name | Type | Record ______________|______|___________ pg.database.com | A | ip_address_1 pg.database.com | A | ip_address_2 pg.database.com | A | ip_address_3 pg.database.com | A | ip_address_4
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Support connection load balancing in libpq
- 7f5b19817eaf 16.0 cited