How to handle failover Timeout with JDBC - Retrying failed queries

0

We created a Multi-AZ AWS Postgres (13.4) RDS Instance and are using a java application with Spring + hibernate and HikariCP as poolmanager. If a failover occures in the middle of a query, the query will fail and throw an exception, afterwards HikariCP will wait for a new connection and the application will continue working. We were hoping that there is a way to retry queries that failed due to a failover, either on AWS side by caching the query during downtime or by the use of the RDS proxy, but there is no such functionality.

Is there a way to configure RDS, RDS-proxy, Postgres or another aws service to retry failed queries or do we have to handle these errors within our application?

1 Answer
0

Hello,

It's typically the JDBC driver that should be cluster-aware and that's smart enough to cache, failover and retry. It's done the same way on different DB engines, special drivers are provided by DB vendors that achieve all or some of these functionalities.

AWS provides its own JDBC Postgres driver that's cluster-aware but only when used with Aurora (not regular RDS Postgres database): https://github.com/awslabs/aws-postgresql-jdbc

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions