Commit Graph

54 Commits

Author SHA1 Message Date
Noah Stapp
bbb6f88fae
PYTHON-5257 - Turn on mypy disallow_any_generics (#2456) 2025-08-06 14:21:53 -04:00
Jeffrey A. Clark
166821f22c
PYTHON-5205 Replace http with https in doc links (#2204) 2025-03-14 21:37:11 -04:00
Noah Stapp
a5c0db66a1
PYTHON-4589 - Add async API docs (#1755) 2024-07-30 13:18:40 -07:00
Noah Stapp
ffa6555485
PYTHON-4476 Separate data and IO classes more effectively (#1678) 2024-06-26 10:12:39 -07:00
Noah Stapp
d6bf0e1e78
PYTHON-4264 Async PyMongo Beta (#1629) 2024-06-06 09:01:24 -07:00
Noah Stapp
62c6d0f330
PYTHON-3587 Do not perform server selection to determine sessions support (#1491) 2024-02-05 13:19:26 -08:00
Steven Silvester
6537415da7
PYTHON-3605 Move type annotations to parameter list in rendered docs (#1441) 2023-11-27 09:24:00 -06:00
Steven Silvester
992d1507e7
PYTHON-4005 Replace flake8 and isort with ruff (#1399) 2023-10-19 11:56:22 -05:00
Steven Silvester
6f4e617e6d
PYTHON-3905 Use from __future__ import annotations in all files (#1370)
* PYTHON-3905 Use from __future__ import annotations in all files

* cleanup

* cleanup

* cleanup
2023-09-11 10:49:24 -05:00
Iris
34da931b3a
PYTHON-3867 add types to topology.py (#1346) 2023-08-09 14:21:43 -07:00
Iris
adbb578b9d
PYTHON-3862 add types to server_description.py (#1322) 2023-07-24 16:03:13 -07:00
Shane Harvey
0092b0af79
PYTHON-2504 Run pyupgrade 3.4.0 and ruff 0.0.265 (#1196)
pyupgrade --py37-plus bson/*.py pymongo/*.py gridfs/*.py test/*.py tools/*.py test/*/*.py
ruff --fix-only --select ALL --fixable ALL --target-version py37 --line-length=100 --unfixable COM812,D400,D415,ERA001,RUF100,SIM108,D211,D212,SIM105,SIM,PT,ANN204,EM bson/*.py pymongo/*.py gridfs/*.py test/*.py test/*/*.py
2023-05-11 15:27:17 -07:00
Steven Silvester
b38a416836
PYTHON-3162 Deprecate ServerDescription.election_tuple (#1189) 2023-04-12 11:10:28 -05:00
Shane Harvey
32faa261b6
PYTHON-3616 Use minimum RTT for CSOT maxTimeMS calculation (#1163)
Require at least 2 RTT samples, otherwise use 0 as RTT. Only keep last 10 samples.
2023-02-23 11:09:11 -08:00
Steven Silvester
a0fe7c03af
PYTHON-3120 Set up flake8 linting (#868) 2022-02-17 06:44:08 -06:00
Steven Silvester
5578999a90
PYTHON-1834 Use a code formatter (#852) 2022-02-09 06:44:28 -06:00
Steven Silvester
dd6c140d43
PYTHON-3060 Add typings to pymongo package (#831) 2022-02-02 21:12:36 -06:00
Bernie Hackett
ad4315134c PYTHON-2803 Get rid of most uses of 'master'
This change also resolves PYTHON-2848 for MongoDB 4.0.
2021-09-13 12:50:49 -07:00
Shane Harvey
3e02957998 PYTHON-2288 Finish removing IsMaster from docs 2021-08-06 12:33:26 -07:00
Prashant Mital
3f8c104157
PYTHON-2288 Remove IsMaster (#690) 2021-07-29 10:32:51 -07:00
Shane Harvey
93ac5e0277
PYTHON-2676 Add load balancer tests in EVG (#625)
Add load balancer spec tests
Ensure LB supports retryable reads/writes
Add assertNumberConnectionsCheckedOut, createFindCursor, ignoreResultAndError
Add PoolClearedEvent.service_id and fix isClientError unified test assertion
2021-05-27 15:05:26 -07:00
Shane Harvey
5bf15c8e18
PYTHON-2672 SDAM, CMAP, and server selection changes for load balancers (#621)
Disable SRV Polling, SDAM compatibility check, logicalSessionTimeoutMinutes check.
server session pool pruning, server selection, and server monitoring.
A ServerType of LoadBalancer MUST be considered a data-bearing server.
"drivers MUST emit the following series of SDAM events" section.
Send loadBalanced:True with handshakes, validate serviceId.
Add topologyVersion fallback when serviceId is missing.
Don't mark load balancers unknown.
2021-05-18 14:12:49 -07:00
Bernie Hackett
cf877e95c7 PYTHON-2503 Always use time.monotonic
For monotonic time needs.
2021-01-25 12:48:31 -08:00
Shane Harvey
1f4123e4bf PYTHON-2123 Streaming heartbeat protocol
MongoClient now requires 2 connections and 2 threads to each MongoDB 4.4+ server.
With one connection, the server streams (or pushes) updated heartbeat info.
With the other connection, the client periodically pings the server to
establish an accurate round-trip time (RTT). This change optimizes the
discovery of server state changes such as replica set elections.

Additional changes:
- Mark server Unknown before retrying isMaster check.
- Always reset the pool _after_ marking the server unknown.
- Configure fail point before creating the client in test SpecRunner.
- Unfreeze with replSetFreeze:0 to ensure a speedy elections in test suite.
2020-07-01 14:49:46 -07:00
Prashant Mital
0743c0b222
PYTHON-2121 add directConnection URI option 2020-06-08 15:11:55 -07:00
Shane Harvey
7099e1be8b PYTHON-2199 Reduce race conditions in SDAM error handling
Use Pool.generation and topologyVersion to reduce race conditions
SDAM error handling.
Implement SDAM error handling spec tests.
2020-04-28 16:47:13 -07:00
Shane Harvey
463d759ddc PYTHON-2116 Add __repr__ to monitoring events and description classes 2020-04-20 16:13:14 -07:00
Shane Harvey
d7128c130c PYTHON-2024 Skip publishing SDAM events for "equivalent" ServerDescriptions 2020-02-24 16:32:09 -08:00
Shane Harvey
a15266083b PYTHON-1674 Support retryable reads
Add retryReads URI option that defaults to True.
Supported read operations will be retried once after transient
network, election, and shutdown errors on MongoDB 3.6+.
Supported operations are:
listCollections, listIndexes, and listDatabases
distinct
count, estimated_document_count, count_documents
aggregate (not including $out)
find (only for the initial find command, getMore commands are not
retried).
ChangeStreams: watch (initial aggregate command).
GridFS read APIs.

Test changes:
Add retryable reads spec test runner.
Disable retryable reads in network error tests.
2019-04-25 14:28:12 -07:00
Shane Harvey
6bab444bd7 PYTHON-1673 Mongos pinning for sharded transactions
In a sharded transaction, a session is pinned to the mongos server
selected for the initial command. All subsequent commands in the same
transaction are routed to the pinned mongos server.
2019-02-27 15:56:48 -08:00
Bernie Hackett
749c1a2f0b PYTHON-1467 - PyMongo no longer supports Python 2.6 2018-07-02 15:15:43 -07:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Shane Harvey
47302096f9 PYTHON-1339 Retryable multi-statement writes.
MongoClient with retryWrites=true works when the cluster does not support retryable writes.
2017-11-20 12:18:00 -08:00
A. Jesse Jiryu Davis
df018e88e2 PYTHON-1332 - Gossip $clusterTime 2017-10-12 09:08:38 -04:00
A. Jesse Jiryu Davis
cbe3e3b9ab PYTHON-1349 - Read session timeout from isMaster 2017-08-23 21:55:46 -04:00
A. Jesse Jiryu Davis
726921a034 Revert "PYTHON-1163 update topology from handshake reply"
23d3c2ee86
2016-11-23 11:43:23 -05:00
A. Jesse Jiryu Davis
23d3c2ee86 PYTHON-1163 update topology from handshake reply 2016-11-22 16:36:32 -05:00
A. Jesse Jiryu Davis
91f2f973af PYTHON-1192 - Minimum maxStalenessSeconds is 90.
Revert code to parse "idleWritePeriodMillis" from ismaster, and revert
changes that allowed maxStalenessSeconds to be a float.
2016-11-22 13:19:34 -05:00
A. Jesse Jiryu Davis
497e316d34 PYTHON-1104 - Support idleWritePeriodMS. 2016-11-08 21:52:04 -05:00
Bernie Hackett
eb7f2e625a PYTHON-1138 - Improve SDAM monitoring documentation 2016-09-01 17:49:30 -07:00
Bernie Hackett
f570f322c3 PYTHON-1142 - Add topology_type_name and server_type_name 2016-09-01 13:23:32 -07:00
A. Jesse Jiryu Davis
5933730588 PYTHON-1104 Implement maxStalenessMS. 2016-07-22 14:12:40 -04:00
A. Jesse Jiryu Davis
c34eec8fad PYTHON-1036 use setVersion to detect stale primary 2015-12-23 17:22:43 -06:00
Luke Lovett
22c79ac0f6 PYTHON-999 - Update SDAM tests and fix related failures. 2015-10-07 11:55:35 -07:00
A. Jesse Jiryu Davis
3d1c20669c PYTHON-924 - Use electionId to detect stale primaries. 2015-05-11 12:17:59 -04:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
A. Jesse Jiryu Davis
27c961a2ab PYTHON-857 - Use client._get_socket_for_writes for OP_INSERT.
We must get a socket *before* choosing whether to use write commands or legacy
writes. I will update the code in steps, getting a socket earlier and earlier
in the write path.

This commit gets a socket just before sending OP_INSERT in _do_batched_insert,
and temporarily disables the C version of _do_batched_insert.
2015-03-16 12:34:45 -04:00
A. Jesse Jiryu Davis
ecc55f502a New method to calculate average round trip time.
Replace 5-sample moving average with exponentially weighted average,
required by the upcoming Server Selection Spec. Move responsibility for
tracking the average from ServerDescription to Monitor. Now the
ServerDescription only knows the average at the time it was created.
2014-12-03 16:30:35 -05:00
A. Jesse Jiryu Davis
ff7958ad38 PYTHON-525 Helpful connection error messages. 2014-11-18 12:14:35 -05:00
A. Jesse Jiryu Davis
0e222c4c4c Rename "set_name" to "replica_set_name".
Rename the attributes of IsMaster, ServerDescription, TopologyDescription, and
TopologySettings from "set_name" to "replica_set_name" for greater clarity.
2014-11-17 20:29:16 -05:00