-
Notifications
You must be signed in to change notification settings - Fork 12
Adding Retry policy to provide optional capabilities #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well.
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.