Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A retryable overload reply can leave exhaust-stream state stale, causing a receive-only retry to block indefinitely with the default socket timeout.
1 open issue
What changed in this PR
This PR addresses PYTHON-6262 by routing pinned cursor getMore operations through PyMongo’s retryable-read handling, allowing overload retries on the same connection in load-balanced mode.
Changes:
- Passes pinned connection managers through the shared retry machinery.
- Adds regression coverage for pinned retries and skips an incompatible multi-mongos test.
- Expands load-balancer CI coverage and documents the fix.
| File | Description |
|---|---|
test/test_retryable_writes.py |
Generated sync skip for the multi-mongos test in load-balanced mode. |
test/test_client_backpressure.py |
Generated sync coverage for pinned overload retries and retry limits. |
test/asynchronous/test_retryable_writes.py |
Skips the multi-mongos test in load-balanced mode. |
test/asynchronous/test_client_backpressure.py |
Tests pinned overload retries and retry limits. |
pymongo/synchronous/mongo_client.py |
Generated sync integration of pinned connections into retry handling. |
pymongo/mongo_client_shared.py |
Stores the pinned connection manager in shared retry state. |
pymongo/asynchronous/mongo_client.py |
Routes pinned reads through retry handling while reusing their connection. |
doc/changelog.rst |
Documents the load-balanced getMore retry fix. |
.evergreen/scripts/test_generate_config.py |
Tests the expanded load-balancer marker selection. |
.evergreen/scripts/run_tests.py |
Includes default sync and async suites in load-balancer runs. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The new test fails before exercising the retry guard on pre-7.1 mongos/load-balanced deployments and in Stable API require-v1 variants because it lacks version gating and omits the configured server_api option.
2 open issues
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Pinned-connection retries and receive-only exhaust handling require live-server validation, including a load-balanced topology with failCommand enabled, which could not be exercised in this review environment.
No open issues 🎉
2 resolved since last review
Review effort: Balanced


PYTHON-6262
Changes in this PR
In load-balanced mode, cursors pin to a single connection and every getMore must run on it. The pinned-connection path bypassed the retryable-read wrapper, so a retryable overload error from the server aborted the cursor instead of being retried.
Test Plan
Adds an integration test that pins a cursor and fails getMore with a retryable overload error. The cursor drains while the failures stay within the adaptive retry limit and raises once they exceed it. Needs a live server with failCommand enabled.
Checklist
Checklist for Author
Checklist for Reviewer