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 回答
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
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则