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

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

    XMLWordPrintableJSON

Details

    • Sharding 2021-09-20
    • 37

    Description

      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.

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: