[SERVER-34434] Shell should ignore errors in abortTransaction() helper Created: 12/Apr/18  Updated: 29/Oct/23  Resolved: 18/Apr/18

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 3.7.6

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Tess Avitabile (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-34259 Convert existing transaction jstests ... Closed
is related to SERVER-34441 Error when aborting/committing a none... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2018-04-23
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 18/Apr/18 ]

Author:

{'email': 'tess.avitabile@mongodb.com', 'name': 'Tess Avitabile', 'username': 'tessavitabile'}

Message: SERVER-34434 Shell should ignore errors in abortTransaction() helper
Branch: master
https://github.com/mongodb/mongo/commit/53c378f137bc4f577f6c92f71f47ede70ec93456

Comment by Tess Avitabile (Inactive) [ 17/Apr/18 ]

benety.goh, did you have a suggestion for what the test helper should look like? I think you suggested two helpers, where one helper asserts that the abortTransaction command was successful, and the other asserts that it failed with a particular error.

Comment by Gregory McKeon (Inactive) [ 12/Apr/18 ]

As part of this ticket, we should add a method that aborts without aborting errors and change our tests to use that method.

Generated at Thu Feb 08 04:36:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.