Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2089

Only apply TransientTransactionError label within a transaction

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.5, 3.4.0
    • Affects Version/s: 3.2.7
    • Component/s: None
    • None

      We currently append a TransientTransactionError label to any MongoNetworkError, regardless of whether it’s in a transaction or not. This is confusing and makes it seem as though we are implicitly creating a transaction. We should only add this label when we are within a transaction.

      daniel.aprahamian's suggested fix in lib/core/wireprotocol/command.js:

        const commandResponseHandler = inTransaction
          ? function(err) {
              // Here is what we are changing
              if (err && err instanceof MongoNetworkError && !err.hasErrorLabel('TransientTransactionError') < 0) {
                err.errorLabels.push('TransientTransactionError')
              }
              // Changes end
              if (
                !cmd.commitTransaction &&
                err &&
                err instanceof MongoError &&
                err.hasErrorLabel('TransientTransactionError')
              ) {
                session.transaction.unpinServer();
              }
      
              return callback.apply(null, arguments);
            }
          : callback;
      

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: