aws / aws-dax-go

AWS DAX SDK for the Go programming language. https://aws.amazon.com/dynamodb/dax
Apache License 2.0
47 stars 48 forks source link

Implement retries on "unknown errors" #39

Open miparnisari opened 1 year ago

miparnisari commented 1 year ago

See https://github.com/aws/aws-dax-go/blob/997685285cd94d0ce25e079671bd2226bbed3da7/dax/internal/client/dax_retryer.go#L64-L68

It is not clear to me what code this error has:

https://github.com/aws/aws-dax-go/blob/07563aa01b18e83de97339068ba52d4e5eb49ee2/dax/internal/client/error.go#L339

But from what i'm seeing in my application, which is calling TransactWriteItemsWithContext, DAX is not retrying on this specific error. I think it should.

Or do you recommend us implementing a retrier?

sumitsa-amazon commented 1 year ago

We recommend application level retry in such cases. The rational is that in case of UnknownErrors, DAX client isn't really aware if the changes made it to DDB and can't determine if it is safe to perform retries. The application is expected to perform sanity validations (if required), and attempt a retry.

This behavior is similar to AmbiguousWriteFailureException in DAX Java SDK ref.