Skip to content

RUBY-3794 Finalize client backpressure#3018

Merged
comandeo-mongo merged 11 commits intomongodb:masterfrom
comandeo-mongo:3794
Apr 14, 2026
Merged

RUBY-3794 Finalize client backpressure#3018
comandeo-mongo merged 11 commits intomongodb:masterfrom
comandeo-mongo:3794

Conversation

@comandeo-mongo
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 with RetryPolicy#max_retries (default DEFAULT_MAX_RETRIES = 2).
  • Add new client + URI options: maxAdaptiveRetries and enableOverloadRetargeting.
  • 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.

Comment thread lib/mongo/client.rb
Comment thread spec/mongo/retryable/client_backpressure_prose_spec.rb Outdated
Comment thread spec/mongo/retryable/write_worker_overload_spec.rb
Comment thread lib/mongo/retryable/backpressure.rb
Comment thread lib/mongo/session.rb
Comment thread lib/mongo/client.rb
@comandeo-mongo comandeo-mongo merged commit 9a4a085 into mongodb:master Apr 14, 2026
203 of 204 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants