Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
None
-
Replication
-
ALL
Description
I'm trying to test how drivers will handle error cases within multi-statement transactions. I perform the following with my prototype of PyMongo that supports transactions:
session = client.start_session()
|
session.start_transaction()
|
collection.insert_one({'_id': 1}, session=session)
|
try:
|
collection.insert_one({'_id': 1}, session=session)
|
except Exception as exc:
|
print(exc)
|
collection.insert_one({'_id': 1}, session=session)
|
session.commit_transaction()
|
It appears (based on debugging) that the transaction includes the document {_id: 1} after the first insert, and the second insert not only causes a duplicate key error, it also aborts the transaction. Therefore the third insert succeeds (outside of any transaction), and the commit_transaction fails with code 125, errmsg "Transaction isn't in progress."
Attachments
Issue Links
- is related to
-
DOCS-11493 Document which errors abort transactions
-
- Closed
-
- related to
-
SERVER-33432 Implicit transaction abort
-
- Closed
-
-
SERVER-34051 Require autocommit:false on all operations as part of an ongoing transaction
-
- Closed
-