-
Notifications
You must be signed in to change notification settings - Fork 119
FR: provide the ability to set per-request RetrySettings #1197
Comments
Hi @skuruppu thanks for the FR, this is something I've been thinking about already, so it's great to have your input. My current idea was limited to just exposing some additional timeout setting on the Can you help me understand the use cases you have in mind?
Fortunately, these changes only need to be scoped to |
Thanks for following up @noahdietz. I will reply inline but @ramiyer, if you could also reply with your specific requirements, that would help a lot since you have a better understanding of how you plan to use this feature.
The initial request was to change the delay settings from my understanding.
They also mentioned that they would like to change the timeouts as well.
I'm not sure so @ramiyer to confirm.
Also not sure so @ramiyer to confirm.
That's great :) |
If any of the backoff settings were in question, I'd say we want the entire Just to set expectation, the way the |
Small update: I took a crack at threading the |
Update: Things got a little more complicated. RPCs that are configured to not be retried at client creation results in a simpler/smaller callable chain being created - one that does not have the same codepath as RPCs that are configured to be retried. In order to make the A. unify the callable chain making retryable and non-retryable RPCs have the same codepath On the other hand, one cannot make a non-retryable RPC retryable on a per-invocation basis unless we also expose overriding the retryable status codes, which I'm not sure we want to do. As such, the concerns might not be a problem at all, and just having per-invocation RetrySettings work for retryable RPCs would be straight forward. FWIW there is already a way to change the timeout of a non-retryable RPC via the |
Yeah, I agree with prioritizing retryable RPCs and not adding this support yet for non-retryable RPCs. We may not want to encourage retrying non-retryable RPCs in any case since if a user needs this, then there are errors that they should handle explicitly. I don't believe the automatic retry logic of gax could handle these cases in a meaningful way. |
Hi folks, so I haven't had time to work on this more, and I am going on leave. I parked the initial changes in #1211, but it does not include the changes necessary for passing these settings through the We haven't scheduled this work, so the team would need to get it on the calendar. I was just exploring this. Explaining the specific use-case more would be useful too. |
@noahdietz thanks for making this much progress and for keeping us in the loop. Let us know if there's anything we can help with to get this work scheduled. I would be more than happy to have @olavloite help out with the implementation as long as there's someone from the gax-java team that can guide the design and implementation. |
Note: @skuruppu and I synced offline and we will have an update on this work in a few days. |
I would say that there are a couple of additional reasons for wanting to be able to set this:
This might not seem very logical from a user perspective. Consider a call that uses the following RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ZERO)
.setInitialRpcTimeout(Duration.ofMillis(100L))
.setTotalTimeout(Duration.ofSeconds(10L))
.setMaxRpcTimeout(Duration.ofSeconds(10L))
.build() This call will fail with a |
Allows applications to supply retry settings and retryabe codes for individual RPCs through ApiCallContext. Fixes googleapis#1197
* feat: support retry settings and retryable codes in call context Allows applications to supply retry settings and retryabe codes for individual RPCs through ApiCallContext. Fixes #1197 * chore: fix formatting and license headers * feat: use context retry settings for streaming calls * fix: process review comments * fix: missed one Thread.sleep * fix: fix style * fix: address review comments * refactor: remove ContextAwareResultRetryAlgorithm * refactor: remove ContextAwareTimedRetryAlgorithm * fix: make package-private + add ignored * revert: revert to always using global settings for jittered * test: add tests for NoopRetryingContext * chore: cleanup 'this' usage * refactor: merge context aware classes with base classes * chore: cleanup and remove unnecessary methods * test: add safety margin as the retry settings are now jittered * docs: add javadoc * chore: address review comments * fix: address review comments * fix: add tests + fix potential NPE * fix: remove unused method + add tests * test: add additional test calls * fix: deprecation
In googleapis/java-spanner, we want to allow users set per-request timeout and retry settings.
Currently, the timeouts and retry settings are set at the time of client creation when the UnaryCallable is created (example). This means the retry settings are fixed per client instance. Our customers have requested for the ability to set RetrySettings per request, so that they may even be able to set them programmatically depending on the type of query that is being executed.
There is a discussion on this in #561 but I would like to create an explicit feature request for this.
Note that we have already brought this up with grpc-java and they asked us to follow-up here.
CC @ramiyer
The text was updated successfully, but these errors were encountered: