Skip to content

analyzeUpdate is executed as executeUpdate during retry in the Connection API #2009

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

Closed
olavloite opened this issue Sep 14, 2022 · 0 comments · Fixed by #2010
Closed

analyzeUpdate is executed as executeUpdate during retry in the Connection API #2009

olavloite opened this issue Sep 14, 2022 · 0 comments · Fixed by #2010
Assignees
Labels
api: spanner Issues related to the googleapis/java-spanner API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@olavloite
Copy link
Collaborator

If analyzeUpdate(Statement) is executed in a read/write transaction in the Connection API, and the read/write transaction is aborted, the retry will retry the statement as executeUpdate(Statement) instead of analyzeUpdate(Statement). This will fail, either because the update count that is returned is different, or because the statement contained parameters and these were not bound for the analyze.

@olavloite olavloite added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Sep 14, 2022
@olavloite olavloite self-assigned this Sep 14, 2022
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label Sep 14, 2022
olavloite added a commit that referenced this issue Sep 14, 2022
Retries of read/write transactions in the Connection API did not respect the analyze mode
of update statements. This would cause updates to be executed using AnalyzeMode.NORMAL
during retries, regardless of what was used during the initial attempt.

Fixes #2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant