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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠