GeezerVison is showing github.com — Spanner: Use gax for retries by olavloite · Pull Request #4940 · googleapis/google-cloud-java
Conversation
olavloite
commented
Apr 13, 2019
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Use GAX instead of the custom SpannerImpl.runWithRetries method for retrying server calls.
This migration involves three changes:
- Remove the override of the generated default settings in
GapicSpannerRpc that set the retryable error codes to an empty set. This will automatically enable GAX retries for all server calls using the default values that have already been defined. The defaults are the same as the defaults that are used by SpannerClient.
- Add configuration options to
SpannerOptions to allow the user to change the default RetrySettings. As SpannerOptions is used to create a Spanner instance, which again contains both a DatabaseClient, DatabaseAdminClient and InstanceAdminClient, SpannerOptions must contain configuration options for all three underlying clients.
- The
runWithRetries method in SpannerImpl is removed and all references to it changed into direct calls that will automatically be retried by GAX.
To avoid a lot of unnecessary configuration options on SpannerOptions, the retry settings of the three underlying clients are exposed by exposing the StubSettings.Builders that are used to create the underlying clients. This only adds three extra methods to SpannerOptions, while still granting (advanced) users access to all configuration options.
The client library will use the defaults that are globally defined for retries in the configuration yaml files of Spanner (i.e. in the files spanner_gapic.yaml, spanner_admin_database_gapic.yaml and spanner_admin_instance_gapic.yaml)
The following defaults are defined:
- Spanner default settings:
- Initial retry delay: 1 second
- Retry multiplier: 1.3
- Max retry delay: 32 seconds
- Initial RPC timeout: 60 seconds
- RPC timeout multiplier: 1.0
- Max RPC timeout: 60 seconds
- Total timeout: 600 seconds
- Spanner streaming settings (used for executeStreamingSql and streamingRead):
- Initial retry delay: 1 second
- Retry multiplier: 1.3
- Max retry delay: 32 seconds
- Initial RPC timeout: 120 seconds
- RPC timeout multiplier: 1.0
- Max RPC timeout: 120 seconds
- Total timeout: 1200 seconds
- Spanner long-running settings (used for commit):
- Initial retry delay: 1 second
- Retry multiplier: 1.3
- Max retry delay: 32 seconds
- Initial RPC timeout: 3600 seconds
- RPC timeout multiplier: 1.0
- Max RPC timeout: 3600 seconds
- Total timeout: 3600 seconds
- Database admin default settings (used for all methods except methods that return an operation, i.e. createDatabase and updateDatabaseDdl, these have a total timeout of 24 hours):
- Initial retry delay: 1 second
- Retry multiplier: 1.3
- Max retry delay: 32 seconds
- Initial RPC timeout: 60 seconds
- RPC timeout multiplier: 1.0
- Max RPC timeout: 60 seconds
- Total timeout: 600 seconds
- Instance admin default settings (used for all methods except methods that return an operation, i.e. createInstance and updateInstance, these have a total timeout of 24 hours):
- Initial retry delay: 1 second
- Retry multiplier: 1.3
- Max retry delay: 32 seconds
- Initial RPC timeout: 60 seconds
- RPC timeout multiplier: 1.0
- Max RPC timeout: 60 seconds
- Total timeout: 600 seconds
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Apr 13, 2019
codecov
Bot
commented
Apr 14, 2019
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Merging #4940 into master will increase coverage by 0.33%.
The diff coverage is n/a.

@@ Coverage Diff @@
## master #4940 +/- ##
============================================
+ Coverage 49.98% 50.31% +0.33%
- Complexity 23668 23676 +8
============================================
Files 2238 2238
Lines 226007 226059 +52
Branches 24191 24955 +764
============================================
+ Hits 112974 113751 +777
- Misses 103693 103707 +14
+ Partials 9340 8601 -739
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2eaa9f4...28935c3. Read the comment docs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
codecov-io
commented
May 1, 2019
•
edited by codecov
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Merging #4940 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@ Coverage Diff @@
## master #4940 +/- ##
============================================
+ Coverage 50.41% 50.42% +<.01%
- Complexity 23796 23797 +1
============================================
Files 2251 2251
Lines 226833 226833
Branches 24966 24966
============================================
+ Hits 114368 114370 +2
+ Misses 103858 103857 -1
+ Partials 8607 8606 -1
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db3241b...1302c06. Read the comment docs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR will also solve the original issue mentioned in #3616, as it will enable users to configure timeouts and custom retry settings for a SpannerOptions instance.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
1 more reviewer
kolea2
kolea2 approved these changes
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Labels
cla: yes
This human has signed the Contributor License Agreement.
🚨 critical
P0 critical issue. Requires immediate fix
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|