Commit Graph

134 Commits

Author SHA1 Message Date
Noah Stapp
34ca694c9f
PYTHON-3801 gRPC POC phase 1 (#1317) 2023-07-26 14:01:22 -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
Shane Harvey
8496ed4b3d
PYTHON-3142 Stop using $where in test_maxConnecting (#886) 2022-02-23 11:52:55 -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
Shane Harvey
c94a3ad1df
PYTHON-2585 Remove legacy multi-auth code (#816) 2021-12-09 18:00:41 -08:00
Julius Park
b05ac0e7ba
PYTHON-2460 Client can create more than minPoolSize background connections (#782) 2021-11-08 16:12:45 -08:00
Shane Harvey
b342990934
PYTHON-2164 Add MongoClient.options, remove redundant properties (#772) 2021-11-03 11:21:33 -07:00
Julius Park
d77cb674b6
PYTHON-2717 Treat maxPoolSize=0 the same as maxPoolSize=None 2021-10-21 15:48:58 -07:00
Shane Harvey
df6f6496a4
PYTHON-2927 PYTHON-2937 Skip failing tests on PyPy (#753)
Cleanup test clients more eagerly.
2021-10-13 10:29:38 -07:00
Julius Park
a80169d1fa
PYTHON-2463 Do not allow a MongoClient to be reused after it is closed (#737) 2021-09-24 15:37:24 -07: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
Prashant Mital
b3118e034e
PYTHON-2162 Remove support for ssl* URI options (#706) 2021-08-19 14:58:31 -07:00
Shane Harvey
e3a61b9ff7
PYTHON-1840 Remove waitQueueMultiple and ExceededMaxWaiters (#699) 2021-08-09 10:53:28 -07:00
Shane Harvey
369d175993
PYTHON-2430 Remove all helpers in the message module (#695) 2021-08-06 13:33:21 -07:00
Prashant Mital
f07da34f97
PYTHON-2545 Test Atlas Serverless (#664) 2021-07-27 16:35:09 -07:00
Shane Harvey
4c77d7c855
PYTHON-2677 Better wait queue timeout errors for load balanced clusters (#639)
Remove checkout argument in favor of SocketInfo.pin_txn/pin_cursor()
2021-06-21 18:29:36 -07:00
Shane Harvey
ac2f506ba2
PYTHON-2453 Add MongoDB Versioned API (#536)
Add pymongo.server_api.ServerApi and the MongoClient server_api option.
Support Unified Test Format version 1.1 (serverParameters in
runOnRequirements)
Skip dropRole tests due to SERVER-53499.
2021-01-11 18:16:00 -08:00
Shane Harvey
86b40c195d
PYTHON-2462 Avoid connection storms: implement pool PAUSED state (#531)
Mark server unknown and clear the pool when background connections fail.
Eagerly evict threads from the wait queue when pool is paused. Evicted
threads will raise the following error:
AutoReconnect('localhost:27017: connection pool paused')
Introduce PoolClearedEvent and ConnectionPoolListener.pool_ready.

CMAP spec test changes:
- CMAP unit tests should not use real monitors
- Assert that CMAP threads complete all scheduled operations
2021-01-06 15:15:37 -08:00
Shane Harvey
5625860688
PYTHON-2443 Fix TypeError when pyOpenSSL socket has timeout of None (#527) 2020-12-01 07:57:30 -10:00
Shane Harvey
d1fd3f7e98
PYTHON-2363 Rate limit new connection creations via maxConnecting (#511)
At most 2 connections can be in the pending state per connection pool.
The pending state covers all the work required to setup a new connection
including TCP, TLS, and MongoDB authentication. For example, if two
threads are currently creating connections, a third thread will wait for
either an existing connection to be checked back into the pool or for
one of the two threads to finish creating a connection.

The change reduces the likelihood of connection storms and improves the
driver's ability to reuse existing connections.
2020-11-23 15:55:54 -08:00
Shane Harvey
5b49557c59 PYTHON-2268 Close clients in test suite 2020-06-03 17:05:59 -07:00
Shane Harvey
71d1227932 PYTHON-2115 Remove threading.Lock() from SocketChecker 2020-04-28 16:41:56 -07:00
Bernie Hackett
5df94d08f0 PYTHON-2040 PyOpenSSL support 2020-02-06 18:03:21 -08:00
Shane Harvey
9cf0fbd785
PYTHON-2001 Fix warnings emitted by Python 3.8 (#428)
Fix DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
Fix DeprecationWarning: isAlive() is deprecated, use is_alive() instead
Fix SyntaxWarning: invalid escape sequence
Test Python 3.8 on Travis
2019-11-08 11:48:15 -08:00
Shane Harvey
f588412b67 PYTHON-1842 Implement Connection Monitoring and Pooling spec 2019-06-13 15:50:49 -07:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Bernie Hackett
e8e77f5a2c PYTHON-1227 - Don't use select.POLLNVAL
It causes problems with Jython and seems unnecessary
since we know the fd represents an open socket.
2017-03-27 17:16:37 -07:00
Bernie Hackett
1108a3a8e0 PYTHON-1222 - Attempt to fix pooling test on zSeries 2017-03-18 15:57:50 -07:00
Shane Harvey
d32d2ff7a5 PYTHON-1227 Disable various pool tests on Jython 2017-02-17 13:55:50 -08:00
Shane Harvey
6f4336efd4 PYTHON-1222 Disable test_max_pool_size_with_connection_failure 2017-02-17 13:55:50 -08:00
Shane Harvey
8156688854 PYTHON-1189 Fix race condition in poll.poll
Each Pool guards its poll.poll with a mutex to prevent concurrent calls.
poll and select are retried if they are interrupted with EINTR. Also fixes
PYTHON-1179.
2016-11-18 16:15:41 -08:00
Shane Harvey
5905a86785 PYTHON-1075 Support running the entire test suite with SSL/TLS
SSL connections are configurable via the environment variables
"CLIENT_PEM", "CA_PEM", and "CERT_REQS".
2016-09-28 16:34:14 -07:00
Bernie Hackett
e89ba4bcd0 PYTHON-1026 - Remove test assumption about primary host 2016-09-21 11:15:43 -07:00
Bernie Hackett
b2a6fc61fd Improve socket_closed test 2015-09-21 14:18:19 -07:00
aherlihy
1fefda2e00 PYTHON-307 Replace select with poll on platforms that support it. 2015-07-08 15:03:11 -07:00
aherlihy
1e7ebb1792 PYTHON-933 - "maxPoolSize=0" allowed, causes hang. 2015-06-08 14:23:00 -07:00
A. Jesse Jiryu Davis
e786e993e6 Delete obsolete test_pool_with_fork. 2015-04-01 12:31:18 -04:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Luke Lovett
7b5ae760a9 Close socket in test_pool_check. 2015-03-25 00:31:07 +00:00
A. Jesse Jiryu Davis
f737ec0db9 PYTHON-728 - Translate socket.error to ConnectionFailure in pool.py.
SocketInfo and Pool are now responsible for catching all socket.errors and
gaierrors and translating them to ConnectionFailure. Server and MongoClient
need no longer worry about anything but ConnectionFailure. Functions in pool.py
and network.py still throw socket.errors into SocketInfo and Pool.
2015-03-11 19:57:01 -04:00
Bernie Hackett
4fd6f8a0b1 PYTHON-854 max_pool_size -> maxPoolSize
With this change the max_pool_size named parameter to
MongoClient is removed. It is replaced by the maxPoolSize
MongoDB URI option, which can be passed in a URI, or as a
keyword argument to MongoClient.
2015-03-09 10:08:13 -07:00
Bernie Hackett
8f0bd0a6d4 PYTHON-850 - Change some uses of ConfigurationError to Type/ValueError. 2015-02-26 16:02:25 -08:00
A. Jesse Jiryu Davis
7f42430978 PYTHON-847 Remove disconnect(), synonym of MongoClient.close().
close() seems more standard among MongoDB drivers.
2015-02-25 14:52:34 -05:00
Bernie Hackett
30af616009 PYTHON-821 - Migrate most tests to new the CRUD API. 2015-02-13 08:46:43 -08:00
A. Jesse Jiryu Davis
9b208caed9 PYTHON-829 Call ismaster on each new connection.
Call ismaster on each new connection and store the results on the SocketInfo
instance.

The upcoming Authentication Spec says: "If credentials exist, upon opening a
socket, drivers MUST send an isMaster command immediately. This allows a driver
to determine whether the server is an Arbiter. Calling ismaster additionally
allows the driver to know if the default authentication method for each socket
is MONGODB-CR or SCRAM-SHA-1, avoiding races when the driver repopulates the
pool after a disconnect."

In theory we could choose not to call ismaster if there are no credentials, but
it's simpler always to call ismaster, and paves the way for future breaking
changes to the wire protocol besides the current breaking change to
authentication.
2015-01-26 16:54:14 -05:00
A. Jesse Jiryu Davis
38a6711e70 PYTHON-829 Move some network code to network.py. 2015-01-26 16:54:00 -05:00
A. Jesse Jiryu Davis
2c2b538367 PYTHON-816 Improved test coverage for Pool. 2015-01-12 21:12:27 -05:00
A. Jesse Jiryu Davis
f769c1e816 Update docstring for a test utility, SocketGetter. 2014-12-10 11:54:43 -05:00
A. Jesse Jiryu Davis
49403798dd Avoid ResourceWarnings in TestPooling. 2014-12-08 17:52:03 -05:00