Retry policies

Retry policies allow the DataStax drivers to automatically retry a request upon encountering specific types of server errors.

In these scenarios, a node is designated as a coordinator for the request by the load balancing policy. The coordinator routes the request to the replicas and returns the response to the driver.

Each DataStax driver implements a default retry policy.

C/C++

C#

Java

Node.js

PHP

Python

Ruby

Along with the driver-included retry policies, some drivers allow extended retry policies to implement custom behavior based on read timeout, write timeout, unavailable exceptions, and request errors.

Default retry policy

The default retry policy retries a request when it is safe to do so while preserving the consistency level of the original request. Use this policy for most deployments.

Read timeout

If the number of replicas that reply is greater than or equal to the number of required responses per the consistency level, the default retry policy retries the request. In all other cases, it returns an error.

Read timeout
Read timeout

Write timeout

If the request is a logged batch request and fails to write to the batch log, the default retry policy retries the request. In all other cases, it returns an error.

Write timeout
Write timeout

Unavailable errors

If the request encounters an unavailable error, the default retry policy retries the request using the next host in the load balancing policy.

Unavailable
Unavailable errors

Fall-through retry policy

The fall-through retry policy never retries or ignores a failed request. In all cases, the fall-through retry policy returns an error. Use this policy for applications that need to implement their own business logic to handle retrying a request.

Fall-through retry
Fall through retry

Logging retry policy

The logging retry policy is intended to be a parent policy for another retry policy implementation and only logs the retry decision made by its child policy. This policy is typically used to debug driver retry behavior.

Logging retry
Logging retry policy

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com