Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

wederbrand avatar image
wederbrand asked ·

Is DriverTimeoutException not handled by the DefaultRetryPolicy in Java driver 4.6.1?

I'm reading the documentation to try to understand if the DefaultRetryPolicy handles DriverTimeoutExceptions but, from what I understand, it doesn't.

If the controller is under heavy temporary GC, or the network has a glitch, it would make sense to try the same query againsta another node in the cluster.

Am I wrong? How could I configure the driver to retry idempotent queries if this happens?

java driver
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

You are correct. DriverTimeoutException is not handled by the DefaultRetryPolicy in version 4 of the Java driver.

DriverTimeoutException isn't retried because it will break the guarantee that client requests are completed within the configured client timeout. For example if you've set the client-side timeout to 5 seconds and the coordinator does not respond within 5 seconds, there is no opportunity to retry since the maximum timeout has already been reached.

If the request is retried a second time, it will potentially take another 5 seconds and the request instead blows out to 10 seconds which is way beyond the maximum 5-second timeout. For some further context, see JAVA-2921.

If you would like to retry the request, we recommend you use speculative query execution so that the request is pre-emptively run on another coordinator if the current coordinator is taking too long to respond. For details, see the Speculative query execution page of Java driver 4.6. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Great answer. I get that the client timeout is the actual timeout used until the driver throws DriverTimeoutException. It makes sense.

I just added the speculative retry so I guess that will also get rid fo the DriverTimeExceptions.

Thanks.

0 Likes 0 ·

Happy to help. Cheers!

0 Likes 0 ·