You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cla: yesThis human has signed the Contributor License Agreement.🚨 criticalP0 critical issue. Requires immediate fix
7 participants
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.
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: