[SERVER-28729] Ensure getLastErrorModes with replica set tags are satisfiable Created: 11/Apr/17  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Adistambha Assignee: Backlog - Replication Team
Resolution: Unresolved Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DOCS-10032 Clarify the semantics of replica set ... Closed
is related to SERVER-18407 Ensure getLastErrorDefaults/getLastEr... Closed
Assigned Teams:
Replication
Participants:

 Description   

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.


Generated at Thu Feb 08 04:18:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.