Commit Graph

53 Commits

Author SHA1 Message Date
Shane Harvey
a886922157 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 13:28:06 -08:00
Shane Harvey
45aa656027
PYTHON-1730 Use w:majority when retrying commitTransaction (#393) 2019-02-08 14:39:54 -08:00
Shane Harvey
ecc852c322 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.
2018-12-06 15:28:58 -08:00
Shane Harvey
6fe00109c1 PYTHON-1650 Always increment txnNumber before starting a retryable write 2018-10-08 11:42:02 -07:00
Shane Harvey
35391b7c2c BUMP 3.7.0 2018-06-26 14:08:42 -04:00
Shane Harvey
4f3b6467ab PYTHON-1598 Fix transaction write concern inheritance 2018-06-26 12:07:12 -04:00
Shane Harvey
98e77ba1d2 PYTHON-1483 Prohibit unack'ed writes with explicit sessions 2018-06-25 13:55:50 -05:00
Bernie Hackett
cb34e31cb0 PYTHON-1560 - Update transaction documentation link 2018-06-24 14:55:35 -07:00
Shane Harvey
b5e9007af0 PYTHON-1508 PYTHON-1589 Expand where unknown commit label is raised
Remove has_label api.
Bump required server version for transactions.
2018-06-15 11:29:11 -07:00
Shane Harvey
e4317d286b PYTHON-1508 Retryable commit/abort, has_error_label api
Retryable commitTransaction/abortTransaction.
Retry writes after certain writeConcernErrors.
Add has_error_label api.
Update unacknowledged write concern error messge.
Resync transaction tests and update test runner.
2018-06-07 14:39:52 -07:00
A. Jesse Jiryu Davis
7bd1fac5d6 Obsolete docstring for end_session 2018-06-04 21:54:12 -04:00
Shane Harvey
714577c83e PYTHON-1508 commitTransaction can be called multiple times
This change allows applications to check if their transaction was commited or
not by repeatedly calling commit until the transaction state is known.
If a session is used after a commit for any operation (not including
another commit), the operation is not part of a transaction and the session's
transaction state is reset.
2018-05-29 14:33:21 -07:00
Shane Harvey
cac0d5548f PYTHON-1508 Remove autoStartTransaction and resync tests
Also use the test file's database name and collection name.
2018-05-22 13:29:41 -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
7aeec7b56b PYTHON-1508 Remove stmtId from transaction commands
The statement identifier is no longer required by the server.
2018-04-25 16:04:13 -07:00
Shane Harvey
d1ee646d72 PYTHON-1508 Expand transaction documentation 2018-04-17 13:23:52 -07:00
A. Jesse Jiryu Davis
8d4626c623 Don't send writeConcern within transaction 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
61b7d0f042 Configurable read concern with start_transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
09891a4ff3 Bring autoStartTransaction up to spec 2018-04-16 09:57:45 -04:00
Shane Harvey
b4f153a811 Add and test default_transaction_options 2018-04-16 09:57:45 -04:00
Shane Harvey
e5f5fa229b Revert read_preference pinning 2018-04-16 09:57:45 -04:00
Shane Harvey
a2937aa8eb Revert "Pin transactions to a single server address"
This reverts commit 25bc0858ff566abfabadeca4a3fea177e9c2697c.
2018-04-16 09:57:45 -04:00
Shane Harvey
c6488c117d Ending a session always aborts the transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
c66235176e Test find/getMore with stmtId in transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
0967c7ed6c Add startTransaction:true to the start of all transactions
Also add autocommit:false to all commands in transactions.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
fca0058566 Ignore all server/network errs in abort_transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
6eb0e13393 Support causal consistency with transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
712637ac8b Refactor transaction attributes into _Transaction class
Re-sync transaction spec tests.
2018-04-16 09:57:45 -04:00
Shane Harvey
673de92ec2 Transactions inherit writeConcern from client 2018-04-16 09:57:45 -04:00
Shane Harvey
49494c2548 Add support for start_transaction with-statement 2018-04-16 09:57:45 -04:00
Shane Harvey
656aa1e703 Pin transactions to a single server address 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
116d2c278f Update _finish_transaction()
Check if the session is ended, and always increment txnNumber.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
b41c2af3a0 Enable session.abort_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
c305f14e18 cache Query/GetMore.as_command, send stmtId with commit/abortTransaction
fix comparison of insertedIds in test_transactions.py
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
54ba1b34f3 rewrite how ClientSession handles _ServerSession 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
00878a2f53 new logic for error scenarios 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
ba7c95a9df PYTHON-1462 - Import ABCs from collections.abc 2018-02-12 19:42:44 -08:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Shane Harvey
96b6f8d0d4 Update changelog and causal docs for 3.6. 2017-11-30 14:55:23 -08:00
Shane Harvey
e554d6116c PYTHON-1419 Call endSessions on MongoClient.close. 2017-11-28 14:26:25 -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
Bernie Hackett
4eda4ffaec PYTHON-1340 - Implement causally consistent reads 2017-11-09 17:16:55 -08:00
Shane Harvey
8b1aa3aafa PYTHON-1339 Retryable single-statement writes.
Add retryWrites MongoClient and URI setting.
Retry once for supported single-statement write operations including:
insert_one, update_one, delete_one, find_one_and_update, find_one_and_replace,
find_one_and_delete, update and remove with multi=False, and find_and_modify.
2017-10-30 14:23:16 -04:00
A. Jesse Jiryu Davis
dad61a058b PYTHON-1332 - Update session's last_use 2017-10-05 15:03:36 -04:00
A. Jesse Jiryu Davis
41096d5875 PYTHON-1332 - Check current user owns session 2017-10-02 12:05:11 -04:00
A. Jesse Jiryu Davis
fdf4436201 PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04: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