You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This is a conservative retry policy adapted for the Amazon Keyspaces Service.
26
+
* It allows for a configurable number of attempts, but by default the number of attempts is {@value KeyspacesRetryOption#DEFAULT_KEYSPACES_RETRY_MAX_ATTEMPTS}
27
+
* <p>
28
+
* This policy will either reattempt request on the same host or rethrow the exception to the calling thread. The main difference between
29
+
* this policy from the original {@link com.datastax.oss.driver.internal.core.retry.DefaultRetryPolicy} is that the {@link AmazonKeyspacesExponentialRetryPolicy} will call {@link RetryDecision#RETRY_SAME} instead of {@link RetryDecision#RETRY_NEXT}
30
+
* <p>
31
+
* In Amazon Keyspaces, it's likely that {@link WriteTimeoutException} or {@link ReadTimeoutException} is the result of exceeding current table
32
+
* capacity. Learn more about Amazon Keyspaces capacity here: @see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html">Amazon Keyspaces CapacityModes</a>.
33
+
* In most cases you should allow for small number of retries, and handle the exception in your application threads.
34
+
*
35
+
* <p>To activate this policy, modify the {@code advanced.retry-policy} section in the driver
36
+
* configuration, for example:
37
+
*
38
+
* <pre>
39
+
* datastax-java-driver {
40
+
* advanced.retry-policy {
41
+
* class = com.aws.ssa.keyspaces.retry.AmazonKeyspacesRetryPolicy
publicstaticfinalStringRETRYING_ON_READ_TIMEOUT = "[{}] Retrying on read timeout on same host (consistency: {}, required responses: {}, received responses: {}, data retrieved: {}, retries: {})";
55
+
@VisibleForTesting
56
+
publicstaticfinalStringRETRYING_ON_WRITE_TIMEOUT = "[{}] Retrying on write timeout on same host (consistency: {}, write type: {}, required acknowledgments: {}, received acknowledgments: {}, retries: {})";
57
+
@VisibleForTesting
58
+
publicstaticfinalStringRETRYING_ON_UNAVAILABLE = "[{}] Retrying on unavailable exception on next host (consistency: {}, required replica: {}, alive replica: {}, retries: {})";
59
+
@VisibleForTesting
60
+
publicstaticfinalStringRETRYING_ON_ABORTED = "[{}] Retrying on aborted request on next host (retries: {})";
61
+
@VisibleForTesting
62
+
publicstaticfinalStringRETRYING_ON_ERROR = "[{}] Retrying on node error on next host (retries: {})";
public RetryDecision onReadTimeout(Statement statement, ConsistencyLevel cl, int requiredResponses, int receivedResponses, boolean dataRetrieved, int nbRetry) {
@@ -58,6 +76,4 @@ public void init(Cluster cluster) {
0 commit comments