CSHARP-6089: Client Backpressure with baseBackoffMS#2065
Draft
papafe wants to merge 5 commits into
Draft
Conversation
Update the exponential-backoff formula from 2^(attempt-1) to 2^attempt per the client-backpressure and transactions-convenient-api spec change (mongodb/specifications#1953), and update the dependent backoff tests. Also adds the baseBackoffMS overload integration test.
…and adapt tests to the new OperationContext API - Add Feature.ClientBackpressureBaseBackoffMs (wire version Server90) and gate the integration test on it instead of a server-version string, so it runs on 9.0 pre-release servers rather than skipping until GA. - Adopt the updated spec test 5 shape (absolute backoff bounds + assert the driver parsed baseBackoffMS) for the mocked unit test. - Fix GetOperationRetryBackoffDelay test bounds for the 2^attempt exponent. - Adapt tests to the CSHARP-6011 change (Session moved onto OperationContext; OperationContext(TimeSpan, CancellationToken) and NoTimeout removed).
The async retry path slept the full backpressure backoff via Task.Delay(backoff, operationContext.CancellationToken), which does not fire when the CSOT deadline elapses, so a large server-supplied baseBackoffMS could overshoot the deadline by seconds and surface a late TimeoutException. Add the same early-bail guard the sync path already has (throw the original overload error when the backoff would exceed the remaining timeout), matching the client-backpressure spec's deadline check. Add regression tests to both executor test suites and correct the AGENTS.md note that wrongly claimed the async path needed no guard.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
https://jira.mongodb.org/browse/CSHARP-6089
Implements spec PR mongodb/specifications#1953:
backpressurefield changes fromtrueto the literal string"2".retryAfterMSon an overload error overrides the default backpressure backoff base.Draft: the spec PR (#1953) is still open, and the server field is slated to be renamed
retryAfterMS→baseBackoffMS(SERVER-130142).This PR will need to be finalised after the spec PR has been merged. This includes updating the comments on tests.