PYTHON-5794 - Add prose tests to verify correct retry behavior when a…#2755
Open
NoahStapp wants to merge 10 commits intomongodb:masterfrom
Open
PYTHON-5794 - Add prose tests to verify correct retry behavior when a…#2755NoahStapp wants to merge 10 commits intomongodb:masterfrom
NoahStapp wants to merge 10 commits intomongodb:masterfrom
Conversation
… mix of overload and non-overload errors are encountered
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new prose-style tests and updates client retry logic to ensure that, after encountering a SystemOverloadedError, subsequent retryable (non-overload) errors can continue to use the increased retry budget (per the backpressure spec intent referenced in PYTHON-5794/DRIVERS-3446).
Changes:
- Add new prose tests for “overload then non-overload” sequences for retryable reads and writes (sync + async).
- Update
_ClientConnectionRetryableretry eligibility to track a per-operation_max_retriesbudget that expands when an overload error is observed. - Add helper plumbing in retryable reads tests to synchronously reconfigure fail points from a
CommandFailedEventcallback.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_retryable_writes.py | Adds a new prose test asserting increased write retries after overload then non-overload errors. |
| test/test_retryable_reads.py | Adds setup client + helper to reconfigure fail points from events, and a new prose test for reads. |
| test/asynchronous/test_retryable_writes.py | Async equivalent of the new write prose test. |
| test/asynchronous/test_retryable_reads.py | Async equivalent of the reads helper + new prose test. |
| pymongo/synchronous/mongo_client.py | Adjusts retry logic to expand retry budget after overload errors and enforce via _max_retries. |
| pymongo/asynchronous/mongo_client.py | Async equivalent of the retry budget changes. |
sleepyStick
previously approved these changes
Apr 14, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
sleepyStick
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.
… mix of overload and non-overload errors are encountered
PYTHON-5794
Changes in this PR
Test Plan
Added two new prose tests.
Checklist
Checklist for Author
Checklist for Reviewer