Skip to content

feat(NODE-7467): make token bucket optional in client backpressure#4878

Merged
dariakp merged 7 commits intomainfrom
token-bucket-optional
Mar 10, 2026
Merged

feat(NODE-7467): make token bucket optional in client backpressure#4878
dariakp merged 7 commits intomainfrom
token-bucket-optional

Conversation

@tadjik1
Copy link
Copy Markdown
Member

@tadjik1 tadjik1 commented Feb 24, 2026

Description

Summary of Changes

Node.js implementation of recent addition into client backpressure spec (token bucket is optional and disabled by default).
Spec PR: mongodb/specifications#1902

Notes for Reviewers

What is the motivation for this change?

Release Highlight

Release notes highlight

Double check the following

  • Lint is passing (npm run check:lint)
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

Base automatically changed from NODE-7142-backpressure-backoff to main February 25, 2026 19:00
@tadjik1 tadjik1 force-pushed the token-bucket-optional branch from 783489b to daaefd8 Compare February 27, 2026 10:53
@nbbeeken
Copy link
Copy Markdown
Contributor

nbbeeken commented Mar 5, 2026

@tadjik1 With the specific spec PR and the whole of backpressure now on main in the specifications repo is this ready? :)

@nbbeeken nbbeeken self-requested a review March 9, 2026 15:10
@nbbeeken nbbeeken self-assigned this Mar 9, 2026
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Mar 9, 2026
@dariakp dariakp changed the title feat(NODE-7142): make token bucket optional in client backpressure feat(NODE-7467): make token bucket optional in client backpressure Mar 9, 2026
@dariakp dariakp marked this pull request as ready for review March 9, 2026 15:11
@dariakp dariakp requested a review from a team as a code owner March 9, 2026 15:11
Copilot AI review requested due to automatic review settings March 9, 2026 15:11
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

Adds support for the client backpressure spec update where the token bucket mechanism is optional (disabled by default) and controlled via a new adaptiveRetries option.

Changes:

  • Introduces adaptiveRetries as a parsed URI/client option with a default of false.
  • Gates token-bucket deposit/consume behavior during overload retries behind adaptiveRetries.
  • Adds unit/integration/spec tests covering option parsing and retry behavior (including max retry count and token bucket limiting).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/connection_string.ts Adds adaptiveRetries to connection string option descriptors with default false.
src/mongo_client.ts Exposes adaptiveRetries on MongoClientOptions and makes it required on parsed MongoOptions.
src/sdam/topology.ts Plumbs adaptiveRetries into TopologyOptions for downstream retry behavior checks.
src/operations/execute_operation.ts Makes token bucket accounting/enforcement conditional on adaptiveRetries.
test/unit/connection_string.test.ts Verifies adaptiveRetries default and enabling via URI/options.
test/tools/uri_spec_runner.ts Adds adaptiveRetries to the URI spec runner’s directly-mapped option assertions.
test/spec/uri-options/client-backpressure-options.yml New URI option spec cases for adaptiveRetries parsing and invalid values.
test/spec/uri-options/client-backpressure-options.json JSON equivalent of the new adaptiveRetries URI spec cases.
test/integration/client-backpressure/client-backpressure.prose.test.ts Updates/adds prose tests for token bucket enforcement and overload retry limits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

nbbeeken
nbbeeken previously approved these changes Mar 9, 2026
@dariakp dariakp added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Mar 10, 2026
@dariakp dariakp merged commit 4fb0a0a into main Mar 10, 2026
27 of 30 checks passed
@dariakp dariakp deleted the token-bucket-optional branch March 10, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team Review Needs review from team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants