Commit Graph

70 Commits

Author SHA1 Message Date
Julius Park
9562a81903
PYTHON-3119 getMore helper should explicitly send inherited comment (#904) 2022-03-25 16:47:18 -07:00
Steven Silvester
b3604a81d3
PYTHON-3171 Add usage of NoReturn annotation (#901) 2022-03-16 15:26:10 -05:00
Steven Silvester
a0fe7c03af
PYTHON-3120 Set up flake8 linting (#868) 2022-02-17 06:44:08 -06:00
Shane Harvey
09f8aa9928
PYTHON-3072 Use _Address in more places (#871) 2022-02-15 15:49:39 -08: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
Shane Harvey
f9bfd11290
PYTHON-2870 Add support for man/text/latex/etc.. docs output (#708)
Regenerate sphinx makefile with sphinx-quickstart 3.5.4.
Remove problematic mongodoc sphinx extension.
2021-08-19 13:31:46 -07:00
Prashant Mital
70a1fec9a2
PYTHON-1363 Remove unused retrieved parameter from CommandCursor (#689) 2021-07-28 15:55:21 -07:00
Prashant Mital
8675dc0ea1
PYTHON-2799 Use namespace returned from initial command response for killCursors (#666) 2021-07-07 15:24:49 -07:00
Shane Harvey
6bc5e088af
PYTHON-1272 Fix deadlock when garbage collecting pinned cursors and sessions (#642)
It's not safe to return the pinned connection to the pool from within
Cursor.del because the Pool's lock may be held by a python thread
while the cyclic garbage collector runs. Instead we send the cursor
cleanup request to the client's background thread. The thread will
send killCursors on the pinned socket and then return the socket to
the pool.
Also fixed a similar bug when garbage collecting a pinned session.
2021-06-22 17:29:26 -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
c8f32a7a37 PYTHON-2673 Connection pinning behavior for load balanced clusters (#630)
Tweak spec test because pymongo unpins cursors eagerly after errors.
Tweak spec test for PoolClearedEvent ordering when MongoDB handshake fails (see DRIVERS-1785).
Only skip killCursors for some error codes.
Rely on SDAM error handling to close the connection after a state change error.
Add service_id to various events.
Retain reference to pinned sockets to prevent premptive closure by CPython's cyclic GC.
2021-06-15 14:14:56 -07:00
Prashant Mital
209d5009e6
PYTHON-1860 Use OP_MSG for find/aggregate_raw_batches when supported (#622) 2021-05-19 12:05:35 -07:00
Shane Harvey
7c1060cfec
PYTHON-1307 Remove SONManipulator APIs (#557) 2021-01-25 16:22:00 -08:00
Bernie Hackett
6c2d629006 PYTHON-2133 Remove Py2 compatibility from pymongo 2021-01-19 21:15:20 -08:00
Prashant Mital
ddac30d2ff
PYTHON-1742 add postBatchResumeToken support
PYTHON-1815 add tests for postBatchResumeToken support
PYTHON-1845 clarify resume token used in resuming and getResumeToken
2019-07-25 17:18:35 -07: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
7f4c504560 PYTHON-1674 Refactor Cursor/CommandCursor.__send_message
Move exhaust getMore out of Cursor.
Move cursor command response decoding into Server so that all command
listener events can be published in the same location.
2019-04-25 14:27:41 -07:00
Shane Harvey
2cb34e4efc PYTHON-1814 Support custom type decoder with distinct
Fix pure python custom type decoding of bson arrays.
2019-04-17 15:44:51 -07:00
Prashant Mital
749116287a
PYTHON-1783 Decode user-facing documents but not internal driver-server
communications.
2019-04-16 15:01:42 -07:00
Shane Harvey
92ddc09b7e PYTHON-1662 Add ChangeStream.try_next API 2019-03-26 11:14:21 -07:00
Shane Harvey
e64945101b PYTHON-1684 Support sharded transactions recovery token (#406)
Transient errors inside transaction unpins the session.
Add brief docs about sharded transactions and add 3.9 changelog.
Tests changes:
Add spec tests for sharded transaction recoveryToken.
Speed up txn tests by reducing SDAM waiting time after a network error.
Remove outdated test workaround for killAllSessions.
2019-02-27 15:59:18 -08:00
Shane Harvey
f9fa34dcd8 PYTHON-1759 Find/getMore command failures reset servers's SDAM state (#406) 2019-02-27 15:59:18 -08:00
Bernie Hackett
548343c29e PYTHON-1551 - Deprecate MongoClient.close_cursor 2018-06-06 11:17:02 -07:00
Shane Harvey
5a652be993 PYTHON-1508 Add read_preference to TransactionOptions
All read operations use the transaction's read preference.
Add transaction read preference spec tests.
Remove write test in test_read_preferences.
2018-05-08 11:38:28 -07:00
Shane Harvey
c6488c117d Ending a session always aborts the transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
cd92850b36 Test changing transaction readPreference
Add original readPreference to getMores to simplify code check.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
9df87b6401 prototype transaction tests 2018-04-16 09:57:45 -04:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Shane Harvey
b669cd86dc PYTHON-1332 Session may only be used by the client that started it.
Centralize $clusterTime receiving.
2017-11-17 09:27:21 -08:00
Shane Harvey
49cee292cc PYTHON-1408 Cursor iteration should complete when another thread closes the cursor.
Closing a cursor should not raise an error when killCursors fails.
2017-11-13 13:08:38 -08:00
Bernie Hackett
4eda4ffaec PYTHON-1340 - Implement causally consistent reads 2017-11-09 17:16:55 -08:00
A. Jesse Jiryu Davis
df018e88e2 PYTHON-1332 - Gossip $clusterTime 2017-10-12 09:08:38 -04:00
Shane Harvey
f0b847adb8 PYTHON-1329 Refactor wire protocol message parsing.
Use _OpReply class instead of passing bytes around.
Remove unnecessary operation argument to receive message.
Move _first_batch to message.py to avoid circular import.
2017-10-09 15:11:50 -07:00
A. Jesse Jiryu Davis
6fa2e4047f PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04:00
A. Jesse Jiryu Davis
c1ec855060 PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04:00
A. Jesse Jiryu Davis
2487e9b71f PYTHON-1332 - Session param for Collection methods 2017-09-11 17:46:44 -04:00
Shane Harvey
74605b73f6 PYTHON-1338 Support change stream API. 2017-09-07 17:12:45 -07:00
A. Jesse Jiryu Davis
3c49e8a0f7 PYTHON-1362 - Useless check in aggregate_raw_batches
The method had checked whether any SON manipulators were configured, and
raised an error if so. But users should understand that SON manipulators
can't affect raw batches, and checking for them raises a deprecation
warning.
2017-09-01 16:20:36 -04:00
A. Jesse Jiryu Davis
cfb30e91c0 PYTHON-1362 - Add find/aggregate_raw_batches()
Rename find_raw to find_raw_batches, and add aggregate_raw_batches.
Rename RawBSONCursor and RawBSONCommandCursor to RawBatchCursor and
RawBatchCommandCursor.
2017-08-25 15:26:16 -04:00
Shane Harvey
b00584b892 PYTHON-1353 Kill cursors synchronously in CommandCursor.close. 2017-08-15 14:58:44 -07:00
Bernie Hackett
80aa1117fd PYTHON-1071 - Use command reported namespace for getMore 2016-03-14 13:47:45 -07:00
aherlihy
b8528100e1 PYTHON-978 - Use getMore command for CommandCursor 2015-11-18 14:12:28 -08:00
aherlihy
1a3aeea426 PYTHON-978 - Use find/getMore commands 2015-11-18 12:57:47 -08:00
Bernie Hackett
28885b25e8 PYTHON-952 - API improvements
This commit implements the following simplifications and improvements:

- The Subscriber ABC has been renamed to CommandListener
- The subscribe function has been renamed to register
- The COMMAND constant has been removed
- The get_subscribers function has been removed
- Command listeners can now be registered per MongoClient instance
  instead of just globally
2015-10-09 17:03:51 -07:00
Luke Lovett
b6182d0587 PYTHON-976 - Publish a CommandFailedEvent for arbitrary failures. 2015-10-07 11:08:05 -07:00
Bernie Hackett
5dba74c005 PYTHON-952 - killCursors monitoring 2015-08-17 16:22:19 -07:00
Bernie Hackett
07d2199477 PYTHON-952 - Fix duration measurements.
We weren't including the time to decode responses in
a number of places. This commit also fixes an issue with
handling "cursor not found" errors from mongos versions
older than 2.4.
2015-08-12 14:04:21 -07:00
Bernie Hackett
fa4a6a39d3 PYTHON-952 - Query and getMore monitoring
This commit adds support for monitoring queries and getMore
operations, including getMore operations for command cursors
(e.g. aggregate cursor getMore). It also fixes a bug in duration
calculation.
2015-08-11 12:19:28 -07:00
aherlihy
66dbe93d45 PYTHON-945 - Remove validation of the OP_REPLY "startingFrom" field. 2015-06-08 16:24:13 -07:00