Skip to content

test(NODE-7470): test that backpressure retries are non-blocking#4891

Merged
PavelSafronov merged 4 commits intomainfrom
NODE-7470/test-backpressure-retries-are-nonblocking
Mar 20, 2026
Merged

test(NODE-7470): test that backpressure retries are non-blocking#4891
PavelSafronov merged 4 commits intomainfrom
NODE-7470/test-backpressure-retries-are-nonblocking

Conversation

@dariakp
Copy link
Contributor

@dariakp dariakp commented Mar 13, 2026

Description

NODE-7470

Summary of Changes

Sync client backpressure tests to latest

Fixed bug that appears on LB topologies: unpin sessions on SystemOverloadedError during retries so that connections are checked back into the pool during the backoff period, rather than being held for the entire retry sequence. This was already handled for MongoNetworkError but not for server-side overload errors, which caused the connection to remain pinned in load-balanced mode across all retry attempts.

Notes for Reviewers

N/A

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

@tadjik1 tadjik1 marked this pull request as ready for review March 17, 2026 16:04
@tadjik1 tadjik1 requested a review from a team as a code owner March 17, 2026 16:04
Copilot AI review requested due to automatic review settings March 17, 2026 16:04
Copy link
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

This PR updates the client backpressure retry behavior and adds a unified spec test to ensure connections are returned to the pool between retry attempts when the server reports overload (particularly relevant for load-balanced topologies where sessions can pin connections).

Changes:

  • Added a new unified spec test asserting connectionCheckedOut/connectionCheckedIn pairing across overload retry attempts.
  • Updated the retry loop to unpin pinned sessions when retrying SystemOverloadedError so connections can be checked back into the pool.
  • Added generated JSON alongside the YAML spec.

Reviewed changes

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

File Description
test/spec/client-backpressure/backpressure-connection-checkin.yml New unified spec asserting connections are checked back in during overload retries.
test/spec/client-backpressure/backpressure-connection-checkin.json Generated JSON version of the new unified spec.
src/operations/execute_operation.ts Adds session unpinning logic on SystemOverloadedError within the retry loop.

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

Copy link
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

This PR updates the Node driver’s client backpressure coverage and fixes a load-balanced (LB) retry behavior where cursor-creating operations could keep a session’s pinned connection checked out across SystemOverloadedError retries, instead of returning it to the pool during backoff.

Changes:

  • Add a new unified test that asserts connections are checked back into the pool between overload retry attempts.
  • Update retry logic to unpin LB sessions on SystemOverloadedError for cursor-creating operations (mirroring existing unpin behavior for MongoNetworkError).

Reviewed changes

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

File Description
test/spec/client-backpressure/backpressure-connection-checkin.yml Adds unified YAML test asserting per-attempt CMAP check-out/check-in for overload retries.
test/spec/client-backpressure/backpressure-connection-checkin.json JSON equivalent of the new unified test for overload retry connection check-in behavior.
src/operations/execute_operation.ts Unpins pinned LB sessions on SystemOverloadedError during retry loop so connections return to the pool during backoff.

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

@tadjik1 tadjik1 requested review from a team March 18, 2026 14:35
Copy link
Contributor

@PavelSafronov PavelSafronov left a comment

Choose a reason for hiding this comment

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

Looks good!

@PavelSafronov PavelSafronov self-assigned this Mar 20, 2026
@PavelSafronov PavelSafronov added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Mar 20, 2026
@PavelSafronov PavelSafronov merged commit a4790f9 into main Mar 20, 2026
34 checks passed
@PavelSafronov PavelSafronov deleted the NODE-7470/test-backpressure-retries-are-nonblocking branch March 20, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Primary Review In Review with primary reviewer, not yet ready for team's eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants