Skip to content

feat(NODE-7624): support baseBackoffMS and update client backpressure backoff - #5020

Merged
johnmtll merged 5 commits into
mainfrom
node-7624-backpressure
Aug 19, 2026
Merged

johnmtll merged 5 commits into
mainfrom
node-7624-backpressure

Conversation

@PavelSafronov

@PavelSafronov PavelSafronov commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Summary of Changes

Add support for baseBackoffMS to existing client backpressure drivers.
This change also alters how backoffs are calculated and changes the backpressure wire representation.

Release Highlight

Improved Intelligent Workload Management

Improved performance for MongoDB 9.0's Intelligent Workload Management (IWM) by only retrying overload errors when doing so is expected to not worsen server conditions

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

@PavelSafronov
PavelSafronov marked this pull request as ready for review August 13, 2026 17:51
@PavelSafronov
PavelSafronov requested a review from a team as a code owner August 13, 2026 17:51
Copilot AI lite review requested due to automatic review settings August 13, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 server-provided baseBackoffMS to the client backpressure retry logic, updates the exponential backoff calculation to match the revised spec behavior, and updates handshake backpressure metadata to the new wire representation.

Changes:

  • Introduces calculateBaseBackoffMS() and uses it to compute overload retry backoff durations in executeOperation.
  • Updates retry backoff math in transactions and client-backpressure prose tests to reflect the new backoff schedule.
  • Changes handshake backpressure metadata from true to the new '2' representation and updates related tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/unit/operations/execute_operation.test.ts Adds unit tests for calculateBaseBackoffMS() behavior.
test/spec/client-backpressure/README.md Updates prose spec text for revised backoff schedule and adds baseBackoffMS prose steps.
test/integration/transactions-convenient-api/transactions-convenient-api.prose.test.ts Adjusts expected retry-backoff timing for transaction convenient API prose test.
test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts Updates handshake backpressure assertions to expect '2'.
test/integration/client-backpressure/client-backpressure.prose.test.ts Updates backoff timing assertions and adds an integration test for server-provided baseBackoffMS.
src/sessions.ts Updates transaction retry backoff exponent to match new attempt numbering.
src/operations/execute_operation.ts Exposes base backoff constant, adds calculateBaseBackoffMS(), and updates overload retry backoff calculation.
src/cmap/connect.ts Updates handshake document backpressure metadata type/value to '2'.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/operations/execute_operation.ts Resolved
Comment thread test/spec/client-backpressure/README.md Resolved
@johnmtll johnmtll self-assigned this Aug 13, 2026
@johnmtll johnmtll added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 13, 2026
Comment thread src/operations/execute_operation.ts Resolved
Comment thread test/spec/client-backpressure/README.md Resolved
johnmtll
johnmtll previously approved these changes Aug 14, 2026
@johnmtll johnmtll added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Aug 18, 2026
@dariakp
dariakp requested a review from nbbeeken August 18, 2026 19:53
Comment thread src/operations/execute_operation.ts Resolved
@johnmtll
johnmtll merged commit 560837b into main Aug 19, 2026
33 checks passed
@johnmtll
johnmtll deleted the node-7624-backpressure branch August 19, 2026 15:56
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.

5 participants