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

dassert() in TransactionRouter incorrectly forbids explicitly specifying empty readConcern object

    • Sharding 2021-09-20
    • 37

      A mongod process won't reject an explicit {readConcern: {}} object even when it is not the first statement within a multi-statement transaction. The {readConcern: {}} object has no practical effect and won't lead the request to do any additional waiting. (Note also that an empty readConcern object overrides the cluster-wide readConcern value.)

      A mongos process is therefore safe to propagate the explicit {readConcern: {}} object and so this dassert() in TransactionRouter should be adjusted to avoid false positives in testing.

      // The first command sent to a participant must start a transaction, unless it is a transaction
      // command, which don't support the options that start transactions, i.e. startTransaction and
      // readConcern. Otherwise the command must not have a read concern.
      auto cmdName = cmd.firstElement().fieldNameStringData();
      bool mustStartTransaction = isFirstStatementInThisParticipant && !isTransactionCommand(cmdName);
      
      if (!mustStartTransaction) {
          dassert(!cmd.hasField(repl::ReadConcernArgs::kReadConcernFieldName));
      }
      

            Assignee:
            jonathan.lee@mongodb.com Jonathan Lee
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: