-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spanner: Use gax for retries #4940
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: Use gax for retries #4940
Conversation
Codecov Report
@@ 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.
|
93fa13d to
7fc30fe
Compare
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Outdated
Show resolved
Hide resolved
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Show resolved
Hide resolved
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Outdated
Show resolved
Hide resolved
c5cfbd5 to
615a600
Compare
Codecov Report
@@ 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.
|
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Outdated
Show resolved
Hide resolved
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Outdated
Show resolved
Hide resolved
...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java
Outdated
Show resolved
Hide resolved
129a2d0 to
000f3c3
Compare
|
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. |
Use GAX instead of the custom
SpannerImpl.runWithRetriesmethod for retrying server calls.This migration involves three changes:
GapicSpannerRpcthat 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 bySpannerClient.SpannerOptionsto allow the user to change the defaultRetrySettings. AsSpannerOptionsis used to create aSpannerinstance, which again contains both aDatabaseClient,DatabaseAdminClientandInstanceAdminClient,SpannerOptionsmust contain configuration options for all three underlying clients.runWithRetriesmethod inSpannerImplis 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 theStubSettings.Buildersthat are used to create the underlying clients. This only adds three extra methods toSpannerOptions, 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: