feat(Bigtable): expose totalTimeoutMillis in RetrySettings for Read and Mutate Rows#8223
feat(Bigtable): expose totalTimeoutMillis in RetrySettings for Read and Mutate Rows#8223
Conversation
| * Only $maxRetries and $totalTimeoutMillis work for RetrySettings in this API. | ||
| * | ||
| * @option int $maxRetries Number of times to retry. **Defaults to** `3`. | ||
| * @option int $totalTimeoutMillis The max accumulative timeout in total. |
There was a problem hiding this comment.
should we specify in the doc that 0 means no total timeout?
There was a problem hiding this comment.
We can do that, although it maybe relevant to note that in the other API methods, RetrySettings::$totalTimeoutMillis is required, and so setting it to 0 actually results in the value 0 for total timeout (which would essentially disable retries).
For that reason, it probably would make more sense for us to make -1 mean no total timeout, so that if a user passes in 0 in both cases, the behavior is consistent. What do you think? Do you know what other language libraries are doing?
There was a problem hiding this comment.
I know in java 0 means no total timeout
There was a problem hiding this comment.
Then unless it's a requirement for this feature (which maybe it is?) I'd rather leave it consistent with the rest of our RetrySettings
There was a problem hiding this comment.
Ok I think we can keep the current behavior and just add a comment to call it out
| return $retrySettings->getTotalTimeoutMillis(); | ||
| } | ||
|
|
||
| return $retrySettings['totalTimeoutMillis'] ?? 0; |
There was a problem hiding this comment.
note: this means the default is no retries, which we probably don't want to do
|
@mutianf Ping on this, I'd love your LGTM if possible! |
70ec7b7 to
55454c5
Compare
b/391904703
Fixes the Bigtable conformance tests by ensuring that an operation timeout is set:
TestMutateRows_Generic_DeadlineExceededTestReadRow_Generic_DeadlineExceededTestReadRows_Generic_DeadlineExceededAn operation timeout (timeout for the entire operation including retries) can now be set by passing
totalTimeoutMillisas part of theRetryOptionsarray:Important: I've added preempting rpc timeout in 1e152c1 which overrides
timeoutMilliswhen it's less than the remaining time in the operation. For example, if we retry twice at100msand ourtotalTimeoutMillisis220ms, then the third retry attempt will have atimeoutMillisof20s. Otherwise thetotalTimeoutMilliswouldn't kick in until after300ms.