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

Ensure getLastErrorModes with replica set tags are satisfiable

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • Replication

      This ticket is an extension to SERVER-18407 to cover custom write concern settings with replica set tags.

      As with SERVER-18407, it is presently possible to create a custom write concern setting using replica set tags that is impossible to be satisfied. For example:

      > rs.conf()
      ...
          "members": [
              {
                  "_id": 0
                  "tags": {
                      "ssd": "installed"
                  }
              },
              {
                  "_id": 1
                  "tags": {
                      "ssd": "installed"
                  }
              }
          ],
          "settings": {
              "getLastErrorModes": {
                  "ssdWriteConcern": {
                      "ssd": 2
                  }
              }
          }
      

      Please note the identical "ssd": "installed" tag defined in the replica set members.

      Using this setting, attempts to insert into the collection using the user-defined custom write concern of w: ssdWriteConcern will always fail. The server apparently counts the number of unique values in the associated replica set tags to determine that the write concern was satisfied:

      > db.test.insert({a:1},{writeConcern:{w:'ssdWriteConcern'}})
      Inserted 1 record(s) in 3ms
      WriteResult({
        "nInserted": 1,
        "writeConcernError": {
          "code": 100,
          "codeName": "CannotSatisfyWriteConcern",
          "errmsg": "Not enough nodes match write concern mode \"ssdWriteConcern\""
        }
      })
      

      The desired behaviour is to output a similar error message as per SERVER-18407 if the write concern can never be satisfied given a replica set configuration.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            kevin.adistambha@mongodb.com Kevin Adistambha
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: