Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13508

Investigate changes in SERVER-44333: mongos accepts empty wc on commands that don't support writeConcern

      Description

      Downstream Change Summary

      mongos no longer accepts an empty wc on commands that do not support write concern (e.g., ping). This behavior is now consistent with mongod.

      Description of Linked Ticket

      This is inconsistent with mongod, which always rejects the writeConcern field on commands where supportsWriteConcern() returns false.

      The problem is that this check is using !wcResult.usedDefault, rather than something like request.body.hasField(WriteConcernOptions::kWriteConcernField).

      mongod:

      > db.runCommand({ping:1, writeConcern:{w:1}})
      {
              "ok" : 0,
              "errmsg" : "Command does not support writeConcern",
              "code" : 72,
              "codeName" : "InvalidOptions"
      }
      > db.runCommand({ping:1, writeConcern:{}})
      {
              "ok" : 0,
              "errmsg" : "Command does not support writeConcern",
              "code" : 72,
              "codeName" : "InvalidOptions"
      }
      

      mongos:

      mongos> db.runCommand({ping:1, writeConcern:{w:1}})
      {
              "ok" : 0,
              "errmsg" : "Command does not support writeConcern",
              "code" : 72,
              "codeName" : "InvalidOptions",
              "operationTime" : Timestamp(1572499322, 1),
              "$clusterTime" : {
                      "clusterTime" : Timestamp(1572499322, 1),
                      "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0)
                      }
              }
      }
      mongos> db.runCommand({ping:1, writeConcern:{}})
      {
              "ok" : 1,
              "operationTime" : Timestamp(1572499322, 1),
              "$clusterTime" : {
                      "clusterTime" : Timestamp(1572499322, 1),
                      "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0)
                      }
              }
      }
      

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            andrew.feierabend@mongodb.com Andrew Feierabend (Inactive)
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              4 years, 5 weeks ago