Repository navigation
[Spec Resync] 06-01-2026 - #2831
Closed
mongodb-drivers-pr-bot[bot] wants to merge 10 commits into
Closed
mongodb-drivers-pr-bot[bot] wants to merge 10 commits into
mongodb-drivers-pr-bot[bot] wants to merge 10 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The server selection spec was updated to expect the "Waiting for suitable server to become available" log message at INFO level. PyMongo was still emitting it at DEBUG, causing test_server_selection_logging failures. Removes the need for the now-deleted PYTHON-4201.patch.
Two spec changes from the 2026-06-01 resync: 1. cursors.json: pinned connections must remain checked out after getMore errors in load balancer mode. Don't call close() on OperationFailure or ConnectionFailure when _sock_mgr is set; just mark _killed=True and let the application release the connection via cursor.close(). 2. sdam-error-handling.json: poolClearedEvent must precede connectionClosedEvent when auth fails. Call handler.handle() before close_conn() in Pool.connect() so SDAM error handling (and the resulting pool reset) fires before the connection is closed.
Two root-cause fixes: 1. AsyncCursor._send_message() also needed the pinned-connection guard — the test uses NonLazyCursor wrapping AsyncCursor, not AsyncCommandCursor. Apply the same _sock_mgr check as the previous commit. 2. Pool.connect(): _raise_connection_failure() was emitting connectionClosedEvent for not-ready connections before handler.handle() could clear the pool. Fix by always deferring the event in _raise_connection_failure() (use close_conn(None)) and emitting it explicitly in connect()'s except block, after pool clearing.
For non-cursor-closed OperationFailures during getMore in load balancer mode, the cursor server-side is still alive. Don't set _killed=True — leave it False so cursor.close() sends killCursors via the pinned connection before releasing it. Only ConnectionFailure (where the server already closed the cursor) should set _killed=True.
blink1073
marked this pull request as draft
June 2, 2026 19:26
Pool fix: make the poolClearedEvent-before-connectionClosedEvent ordering conditional on load_balanced so non-LB auth failures keep their original event order (connectionClosedEvent → connectionCheckOutFailedEvent). Spec patch PYTHON-5791: retryable-writes, commit, and callback spec tests now expect readConcern.afterClusterTime in retried write commands, which PyMongo does not yet send. Add a patch to revert to the old assertions.
The spec patches in .evergreen/spec-patch/ are only applied during spec resyncs, not regular test runs. The spec file changes must also be reverted directly on the branch. Fix the patch file to use the forward diff direction (what was added in the spec) so git apply -R works correctly in future resyncs.
…hon-driver into spec-resync-06-01-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.
Jira tickets: https://jira.mongodb.org/issues/?jql=labels%20%3D%20automated-sync%20AND%20status%20!%3D%20Closed
PYTHON-5812
PYTHON-5720
PYTHON-5533
The following specs were changed:
-connection_monitoring
-load_balancer
-server_selection_logging
-transactions
-transactions-convenient-api
The following spec syncs encountered errors:
-applying patches
The following directories are in the specification repository and not in our test directory:
-open_telemetry
-causal_consistency