Skip to content

Conversation

@olavloite
Copy link

@olavloite olavloite commented Mar 15, 2019

The method SpannerImpl#runWithRetries(Callable) did not consider the retry settings that had been set on the SpannerOptions that created it. This could cause certain calls to wait indefinitely without ever
breaking off with an exception.
This fix changes the SpannerImpl#runWithRetries(Callable) to consider the retry settings set on SpannerOptions.

I also considered changing the implementation into using RetryHelper#runWithRetries, but that API is (according to itself) still beta.

Fixes #3616

…able)

The method SpannerImpl#runWithRetries(Callable) did not consider the
retry settings that had been set on the SpannerOptions that created it.
This could cause certain calls to wait indefinitely without ever
breaking off with an exception.
@olavloite olavloite requested a review from a team as a code owner March 15, 2019 10:24
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 15, 2019
@codecov
Copy link

codecov bot commented Mar 15, 2019

Codecov Report

Merging #4683 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4683   +/-   ##
=========================================
  Coverage     49.51%   49.51%           
  Complexity    22405    22405           
=========================================
  Files          2115     2115           
  Lines        211187   211187           
  Branches      24175    24175           
=========================================
  Hits         104570   104570           
  Misses        98384    98384           
  Partials       8233     8233

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 35cc987...89f2f27. Read the comment docs.

@sduskis sduskis added the api: spanner Issues related to the Spanner API. label Mar 19, 2019
@sduskis sduskis requested a review from kolea2 March 19, 2019 20:44
@kolea2
Copy link
Contributor

kolea2 commented Mar 19, 2019

CC @snehashah16

} else {
backoffSleep(context, backOff);
}
if (options.getRetrySettings() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would suspect the gax library being able to take care of these.

We should sync with gax|gapic team to help here and make this generic across all APIs and client libraries.

@hzyi-google - any thoughts on how to implement this?

Copy link
Contributor

@yihanzhen yihanzhen Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not seem this implementation is using any retry helpers provided by gax. what it's doing seems to be extracting retry configurations set in SpannerOptions and do manual retries here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Spanner library has its own implementation of runWithRetries(...), which also uses io.grpc.Context to allow the user to cancel calls or set timeouts. Re-writing this method, and thereby all the Spanner library, to use the standard helper methods from gax is probably a good idea. But as far as I can see, it will probably also have some side-effects to the current behavior.

Is that something we would want as part of solving this issue, or should that be a separate project?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you that it will be ideal to use retry helpers in gax, and I also think it should be a separate project as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzyi-google, should we close this PR and work on using the GAX retry helpers in another PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sduskis - we can have knut (or whoever) write up a design on migrating to gax, and its side-effects (or gaps in gax library) that Cloud Spanner may have a change in behavior.

I would start a new project and close this PR.
Also, there is a parallel thread for setting timeouts (and rpc cancellations) that should be included in this project (if possible) to make sure we dont drop any existing feature from the clients.

@crwilcox for timeouts & cancellations issue.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 22, 2019
@sduskis sduskis added do not merge Indicates a pull request not ready for merge, due to either quality or timing. needs work This is a pull request that needs a little love. and removed 🚨 This issue needs some love. labels Mar 26, 2019
@yihanzhen
Copy link
Contributor

Sorry for the delay. This PR LGTM. But I think @snehashah16 should approve as well.

@yihanzhen yihanzhen self-requested a review March 26, 2019 16:41
@snehashah16
Copy link
Contributor

@olavloite
"I also considered changing the implementation into using RetryHelper#runWithRetries, but that API is (according to itself) still beta."

Can you provide the link/reference to this library RetryHelper#runWithRetries

@olavloite
Copy link
Author

@snehashah16

Can you provide the link/reference to this library RetryHelper#runWithRetries

com.google.cloud.RetryHelper from google-cloud-core: https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/RetryHelper.java

@olavloite
Copy link
Author

Replaced by #4940

@olavloite olavloite closed this Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing. needs work This is a pull request that needs a little love.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to specify Spanner connect timeout?

7 participants