According to the specification:
If [abortTransaction] fails with a command error, e.g. NoSuchTransaction, this means the transaction was already aborted on the server and drivers MUST ignore the error.
Yet we clearly don't ignore the error: if I simply run
session.abortTransaction()
then the shell throws because it implicitly asserts that the command worked:
[js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.454-0400 assert: command failed: { [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.454-0400 "operationTime" : Timestamp(1523540745, 4), [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.454-0400 "ok" : 0, [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.454-0400 "errmsg" : "Transaction 0 has been aborted.", [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "code" : 251, [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "codeName" : "NoSuchTransaction", [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "$clusterTime" : { [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "clusterTime" : Timestamp(1523540745, 4), [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "signature" : { [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.455-0400 "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 "keyId" : NumberLong(0) [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 } [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 } [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 } [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 _getErrorWithCode@src/mongo/shell/utils.js:25:13 [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 doassert@src/mongo/shell/assert.js:16:14 [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 _assertCommandWorked@src/mongo/shell/assert.js:510:17 [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.456-0400 assert.commandWorked@src/mongo/shell/assert.js:594:16 [js_test:no_writes_to_unreplicated_collection_in_txn] 2018-04-12T09:45:45.457-0400 abortTransaction@src/mongo/shell/session.js:822:17
- is related to
-
SERVER-34259 Convert existing transaction jstests to use new shell API
- Closed
-
SERVER-34441 Error when aborting/committing a nonexistent txn or starting a txn with one running
- Closed