GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Spanner: Use gax for retries by olavloite · Pull Request #4940 · googleapis/google-cloud-java

Conversation

@olavloite

@olavloite olavloite commented Apr 13, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 13, 2019
This was referenced Apr 13, 2019
[WIP] Spanner - Use gax for runWithRetries() #4781
Closed
#3616 use retry settings when executing runWithRetries(Callable) #4683
Closed
@codecov

codecov Bot commented Apr 14, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #4940 into master will increase coverage by 0.33%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...re/src/main/java/com/google/cloud/BaseService.java 55.55% <0%> (-6.95%) 2% <0%> (ø)
...le/cloud/compute/deprecated/DeprecationStatus.java 88.63% <0%> (-3.13%) 20% <0%> (ø)
...va/com/google/cloud/http/HttpTransportOptions.java 56.33% <0%> (-1.64%) 10% <0%> (ø)
...ge/contrib/nio/CloudStorageFileSystemProvider.java 61.26% <0%> (-0.29%) 70% <0%> (ø)
...ain/java/com/google/cloud/logging/LoggingImpl.java 88.44% <0%> (-0.2%) 73% <0%> (ø)
.../google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java 6.92% <0%> (-0.06%) 2% <0%> (ø)
...om/google/cloud/storage/spi/v1/HttpStorageRpc.java 1.82% <0%> (-0.01%) 1% <0%> (ø)
...loud/compute/v1/InsertNodeTemplateHttpRequest.java 23.92% <0%> (ø) 9% <0%> (ø) ⬇️
...in/java/com/google/cloud/compute/v1/NodeGroup.java 38.6% <0%> (ø) 17% <0%> (ø) ⬇️
...java/com/google/cloud/compute/v1/NodeTemplate.java 36.41% <0%> (ø) 19% <0%> (ø) ⬇️
... and 147 more

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olavloite
olavloite force-pushed the spanner-use-gax-for-retries branch from 93fa13d to 7fc30fe Compare April 16, 2019 12:33
@olavloite olavloite changed the title [WIP] Spanner: Use gax for retries Spanner: Use gax for retries Apr 17, 2019
@olavloite
olavloite marked this pull request as ready for review April 17, 2019 10:15
@olavloite
olavloite requested a review from a team April 17, 2019 10:15
kolea2
kolea2 reviewed Apr 18, 2019
View reviewed changes
Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

kolea2
kolea2 reviewed Apr 19, 2019
View reviewed changes
Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

kolea2
kolea2 reviewed Apr 19, 2019
View reviewed changes
Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@yoshi-automation yoshi-automation added the 🚨 critical P0 critical issue. Requires immediate fix label Apr 20, 2019
@olavloite
olavloite force-pushed the spanner-use-gax-for-retries branch from c5cfbd5 to 615a600 Compare April 22, 2019 16:48
@kolea2 kolea2 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2019
@kolea2 kolea2 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 1, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 1, 2019
@codecov-io

codecov-io commented May 1, 2019 •
edited by codecov Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #4940 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...able/gaxx/reframing/ReframingResponseObserver.java 90.82% <0%> (+1.83%) 30% <0%> (+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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kolea2
kolea2 reviewed May 16, 2019
View reviewed changes
Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...loud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sduskis sduskis added needs work This is a pull request that needs a little love. and removed 🚨 critical P0 critical issue. Requires immediate fix labels May 17, 2019
olavloite added 9 commits May 17, 2019 14:54
@olavloite
fixed merge conflicts
365836e
@olavloite
changed references after rebase on master
1b975ae
@olavloite
rebased on refactored SpannerImpl
a6a5342
@olavloite
enable gax retries on rpc calls
2d85dc3
@olavloite
removed runWithRetries and added access to gax settings on options
081569c
@olavloite
try to fix flaky test
e99b45d
@olavloite
added gax config for DatabaseAdminClient
de22aed
@olavloite
increase timeouts to reduce chance of false test failure
eb9f449
@olavloite
increase timeout to avoid false test failures
a791085
olavloite added 16 commits May 17, 2019 15:00
@olavloite
changed read/write tests to use warmed up session pool
d3a01c3
@olavloite
increase timeout to avoid timeouts in warmUpSessionPool
08e2768
@olavloite
fixed formatting
e28da86
@olavloite
set specific retry settings for commit
344f86e
@olavloite
increase initial rpc timeout to avoid slow build to timeout
e9e6c56
@olavloite
added tests for default and setting custom retry settings
b684a0d
@olavloite
add retry loop in warmUpSessionPool
e945c64
@olavloite
added additional documentation
d304978
@olavloite
removed unnecessary passing around SpannerImpl
f78df4d
@olavloite
fixed javadoc build errors
ae6b76d
@olavloite
removed unnecessary import change
02dca04
@olavloite
renamed stub settings builder methods to get...SettingsBuilder
432c132
@olavloite
remove unused import
d90248e
@olavloite
ran code formatter
38267c6
@olavloite
added references to default values
df2ed1f
@olavloite
remove ignored test
000f3c3
@olavloite
olavloite force-pushed the spanner-use-gax-for-retries branch from 129a2d0 to 000f3c3 Compare May 17, 2019 13:06
@olavloite
ran formatter
1302c06
@olavloite olavloite removed the needs work This is a pull request that needs a little love. label May 17, 2019
@yoshi-automation yoshi-automation added the 🚨 critical P0 critical issue. Requires immediate fix label May 17, 2019
@olavloite

olavloite commented May 21, 2019

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chingor13 chingor13 assigned kolea2 May 22, 2019
kolea2
kolea2 approved these changes May 28, 2019
View reviewed changes
@olavloite
olavloite merged commit 2ae5ca0 into googleapis:master May 29, 2019
@olavloite
olavloite deleted the spanner-use-gax-for-retries branch May 29, 2019 06:12
@kolea2 kolea2 mentioned this pull request May 29, 2019
Release google-cloud-java v0.94.0 #5238
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@kolea2 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.

Assignees

@kolea2 kolea2

Labels

cla: yes This human has signed the Contributor License Agreement. 🚨 critical P0 critical issue. Requires immediate fix

Projects

None yet

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.

7 participants

@olavloite @codecov-io @kolea2 @sduskis @googlebot @yoshi-automation @yoshi-kokoro
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.