Skip to content

Conversation

michaelraney
Copy link
Contributor

Adding retry policy and exponential retry policy. When errors occur do to WriteThrottle, ReadThrottle, or System error, Keyspaces returns Cassandra timeout value. This retry policy helps customers retry these errors which are mainly transient in Amazon Keyspaces.
Issue #, if available:

Description of changes:
Including two retry polices. AmazonKeyspacesRetryPolicy and AmazonKeyspacesExponentialRetryPolicy. Both policies have configurable number of retries, but the expoential policy adds an exponential increasing delay between retry attempts. The developer has the ability to customize min wait and max wait to bound execution time.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Adding retry policy and exponential retry policy. When errors occur do to WriteThrottle, ReadThrottle, or System error, Keyspaces returns Cassandra timeout value. This retry policy helps customers retry these errors which are transient.

```
advanced.retry-policy {
class = com.aws.ssa.keyspaces.retry.AmazonKeyspacesRetryPolicy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, How is this class path arrived at? I see this is different from the path used within the classes defined in this PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These classes are being carried over from https://github.com/aws-samples/amazon-keyspaces-java-driver-helpers/blob/main/src/main/java/com/aws/ssa/keyspaces/retry/AmazonKeyspacesRetryPolicy.java to this package and thus the class path will need to be updated now?


long timeToWaitCalculation = Math.max(minWaitTime, exponentialWaitWithJitter);

long timeToWaitFinal = Math.min(maxWaitTime, timeToWaitCalculation);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the variable - totalTimeToWait


stopwatch.stop();

long millsObserved = stopwatch.elapsed().toMillis();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: typo - millisObserved.


stopwatch.stop();

long millsObserved = stopwatch.elapsed().toMillis();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: typo.


stopwatch.stop();

long millsObserved = stopwatch.elapsed().toMillis();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants