GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Spanner: Use generic retry helper for transaction retries by olavloite · Pull Request #5433 · googleapis/google-cloud-java Conversation
Contributor
As discussed in PR #5412 we should move away from custom retry loops and use a generic retry helper. This PR changes the retry loop of read/write transactions from a custom loop to using the Gax
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
kolea2
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind just briefly explaining what this change is? Hard to see from the diff. Is it mainly the return statement at the bottom?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The web diff view is indeed not very helpful in this case... In general: Instead of using a while(true) {...} loop for retrying the transaction, the transaction is placed in a More specifically, the change is as follows:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
kolea2
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the context is cancelled now? Are the same error messages thrown for deadline exceeded and cancelled?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the initial version of this PR, the context was ignored. I've added a check for context cancellation to the generic retry helper, and it will now throw the same exceptions as previous retry loops.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #5433 +/- ## ============================================ + Coverage 50.5% 51.09% +0.58% - Complexity 23903 24475 +572 ============================================ Files 2259 2271 +12 Lines 227870 232042 +4172 Branches 24994 25064 +70 ============================================ + Hits 115088 118552 +3464 - Misses 104163 104838 +675 - Partials 8619 8652 +33
Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| class SpannerRetryHelper { | ||
| private static final RetrySettings txRetrySettings = | ||
| RetrySettings.newBuilder() | ||
| .setInitialRetryDelay(Duration.ofMillis(1000L)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor - I would take these numbers and make them constants.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A Spanner transaction runner that was given a session with a prepared read/write transaction would not use that transaction, but instead always start a new one, causing an extra unnecessary round-trip to the server. This regression was introduced by commit d305770 (PR googleapis#5433).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.