Skip to content
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

Let retry policy to decide about non idempotent queries #376

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sylwiaszunejko
Copy link
Collaborator

This PR:

  • Makes Conn.exec to include a flag into error that signals that query could have been actually executed, despite error been recieved.
  • Picks up this error in queryExecutor.do and if query is not idempotent wrap it with user-facing error that would signal to retry policy and to user that this non idempotent query was failed but could be actually executed.

Fixes: #326, #331

@sylwiaszunejko
Copy link
Collaborator Author

Not sure if potentiallyExecuted is set to correct value everywhere

@sylwiaszunejko sylwiaszunejko self-assigned this Dec 19, 2024
Copy link
Collaborator

@dkropachev dkropachev left a comment

Choose a reason for hiding this comment

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

On next PR let's do some heuristic from server error, take a look at parseErrorFrame

query_executor.go Show resolved Hide resolved
query_executor.go Show resolved Hide resolved
query_executor.go Show resolved Hide resolved
conn.go Outdated Show resolved Hide resolved
query_executor.go Outdated Show resolved Hide resolved
policies.go Outdated
var executedErr *QueryError
if errors.As(err, &executedErr) {
err = executedErr.err
if executedErr.potentiallyExecuted && !executedErr.isIdempotent {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't use them directly, have getters please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

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.

Query retry logic is not triggered in certain cases
2 participants