Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-34434

Shell should ignore errors in abortTransaction() helper

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.6
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • Fully Compatible
    • ALL
    • Repl 2018-04-23

      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
      

            Assignee:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: