This is just from reading the docs:
https://pkg.go.dev/github.com/jackc/pgx/v5@v5.5.1/pgconn#FallbackConfig
is a member of 
https://pkg.go.dev/github.com/jackc/pgx/v5@v5.5.1/pgconn#Config
and its comment seems to match your use case.

I don;t know AWS RDS how does the failover (when is the connection closed), 
but the "table not found" error suggest you have to set the 
Config.AfterConnect parameter, too (see its comment).
Dean Schulze a következőt írta (2024. január 1., hétfő, 3:54:02 UTC+1):

> I have a web service in Gin that calls Postgresql running on AWS RDS with 
> multi-az failover.  When I reboot with failover the primary database and 
> failover starts calls to the web service hang without even getting to the 
> event handler.  Once the failover is complete calls to the web service fail 
> due to not being able to find the Postgresql table.  If I restart the web 
> service then calls to the web service succeed.
>
> I've done this with both sql/db and the github.com/jackc/pgx/v5/pgxpool 
> connection pool.  I hoped the pgxpool would be resilient enough to 
> reconnect once multi-az failover had completed, but this isn't happening.
>
> I could implement retry logic which would probably require a new 
> connection, but the calls that hang don't even get to the event handler.
>
> Is there a pattern for supporting continuing connection or reconnect to 
> Postgresql when failover happens?  Are there drivers or packages that 
> implement this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ab1b5d87-cf31-49a6-872b-d074442ee213n%40googlegroups.com.

Reply via email to