-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spanner: Aborted batch dml should be retried #4955
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
Spanner: Aborted batch dml should be retried #4955
Conversation
When executing batchDml statements, it is possible that the transaction is aborted by Spanner for one of the statements. This used to throw a SpannerBatchUpdateException, which would cause the transaction to fail, while the appropriate exception is AbortedException to trigger a retry of the transaction.
Codecov Report
@@ Coverage Diff @@
## master #4955 +/- ##
============================================
- Coverage 50.36% 49.98% -0.38%
- Complexity 23665 23668 +3
============================================
Files 2233 2238 +5
Lines 225856 226007 +151
Branches 24956 24191 -765
============================================
- Hits 113742 112974 -768
- Misses 103517 103693 +176
- Partials 8597 9340 +743
Continue to review full report at Codecov.
|
...ients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java
Show resolved
Hide resolved
| exception = e; | ||
| updateCount = e.getUpdateCounts(); | ||
| } | ||
| if (status == Code.ABORTED_VALUE) { |
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.
Is there anyway to move the asserts into batchDmlAborted and batchDmlFailedPrecondition?
|
@olavloite LGTM after running code formatting |
When executing batchDml statements, it is possible that the transaction is aborted by Spanner for one of the statements. This used to throw a SpannerBatchUpdateException, which would cause the transaction to fail, while the appropriate exception is AbortedException to trigger a retry of the transaction.