RUBY-3794 Finalize client backpressure#3018
Merged
comandeo-mongo merged 11 commits intomongodb:masterfrom Apr 14, 2026
Merged
Conversation
Remove token bucket integration from RetryPolicy; replace adaptive_retries with max_retries param. Replace MAX_RETRIES/token-bucket constants in Backpressure with DEFAULT_MAX_RETRIES=2.
…verloadRetargeting
Contributor
There was a problem hiding this comment.
Pull request overview
Finalize phase-1 client backpressure rollout by removing the token-bucket/adaptiveRetries mechanism and aligning retry behavior + test fixtures with the new configuration surface (maxAdaptiveRetries, enableOverloadRetargeting).
Changes:
- Replace
adaptiveRetries/token bucket withRetryPolicy#max_retries(defaultDEFAULT_MAX_RETRIES = 2). - Add new client + URI options:
maxAdaptiveRetriesandenableOverloadRetargeting. - Update unified spec fixtures and prose/unit specs to reflect the new retry limits and option names.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/spec_tests/data/uri_options/client-backpressure-options.yml | Adds URI option coverage for maxAdaptiveRetries and enableOverloadRetargeting. |
| spec/spec_tests/data/transactions_unified/backpressure-retryable-writes.yml | Updates expected retry attempts/events to match new default retry limit. |
| spec/spec_tests/data/transactions_unified/backpressure-retryable-reads.yml | Updates expected retry attempts/events to match new default retry limit. |
| spec/spec_tests/data/transactions_unified/backpressure-retryable-commit.yml | Updates expected retry attempts/events to match new default retry limit. |
| spec/spec_tests/data/transactions_unified/backpressure-retryable-abort.yml | Updates expected retry attempts/events to match new default retry limit. |
| spec/spec_tests/data/client_backpressure/getMore-retried.yml | Adjusts failpoint counts and expected events for reduced overload retries. |
| spec/spec_tests/data/client_backpressure/backpressure-retry-max-attempts.yml | Regenerates fixtures to assert maxAttempts=2 behavior across operations. |
| spec/spec_tests/data/client_backpressure/backpressure-retry-loop.yml | Adjusts failpoint counts and expected events for reduced overload retries. |
| spec/spec_tests/data/client_backpressure/backpressure-connection-checkin.yml | Updates expected CMAP check-in/out events for reduced retry attempts. |
| spec/mongo/retryable/write_worker_overload_spec.rb | Updates overload retry expectations to new retry limit; removes token bucket assertions. |
| spec/mongo/retryable/token_bucket_spec.rb | Removes token bucket unit tests (token bucket removed). |
| spec/mongo/retryable/retry_policy_spec.rb | Updates retry policy tests to validate max_retries semantics + CSOT behavior. |
| spec/mongo/retryable/read_worker_overload_spec.rb | Updates read overload retry expectations to new retry limit; removes token bucket assertions. |
| spec/mongo/retryable/client_backpressure_prose_spec.rb | Updates prose tests to new retry defaults and removes token bucket coverage. |
| spec/mongo/retryable/backpressure_spec.rb | Updates Backpressure constant expectations to DEFAULT_MAX_RETRIES = 2. |
| spec/mongo/retryable/backpressure_options_spec.rb | Adds Ruby-level option tests for max_adaptive_retries and enable_overload_retargeting. |
| spec/mongo/retryable/adaptive_retries_option_spec.rb | Removes obsolete adaptiveRetries option spec. |
| lib/mongo/uri/options_mapper.rb | Maps new URI keys to driver option names/types. |
| lib/mongo/session.rb | Removes token bucket bookkeeping calls from transaction retry logic. |
| lib/mongo/retryable/write_worker.rb | Removes token bucket success/failure accounting hooks from write retry paths. |
| lib/mongo/retryable/token_bucket.rb | Removes token bucket implementation. |
| lib/mongo/retryable/retry_policy.rb | Implements max_retries-based overload retry gating; removes token-bucket logic. |
| lib/mongo/retryable/read_worker.rb | Removes token bucket accounting hooks from read retry paths. |
| lib/mongo/retryable/backpressure.rb | Replaces MAX_RETRIES and token bucket constants with DEFAULT_MAX_RETRIES. |
| lib/mongo/retryable.rb | Gates replica set overload retargeting behind enableOverloadRetargeting; removes token bucket success accounting. |
| lib/mongo/client.rb | Adds new client options and wires max_adaptive_retries into RetryPolicy construction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jamis
approved these changes
Apr 14, 2026
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.
Finalize client backpressure for phase 1 rollout per DRIVERS-3427. Remove the token bucket mechanism and adaptiveRetries option, replacing them with maxAdaptiveRetries (integer, default 2) and enableOverloadRetargeting (boolean, default false). Sync all spec test fixtures and update prose tests accordingly.