[DOCS-10032] Clarify the semantics of replica set tags Created: 24/Mar/17  Updated: 23/Aug/17  Resolved: 12/Apr/17

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Adistambha Assignee: Kevin Adistambha
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-28729 Ensure getLastErrorModes with replica... Backlog
Participants:
Days since reply: 6 years, 44 weeks, 1 day ago

 Description   

The docs page in https://docs.mongodb.com/manual/tutorial/configure-replica-set-tag-sets/ contains an extensive tutorial & examples regarding the use of replica set tag sets. However, the semantics of the tags themselves are not clearly explained.

The tags look like a free-form document, where the "key" is the "tag", and the "value" could be anything the user wants.

However, this is not true. Both the key and the value of the tags are important. At least with regards to write concern.

For example, these tags:

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

This replica set configuration would imply that writes using a writeConcern setting of either w:"production" or w:"ssd" would propagate the writes to both nodes before returning.

Inserting using w:"production", where the members have different values in the tags (i.e. "production": "1" and "production": "2"):

> db.test.insert({a:1},{writeConcern:{w:'production'}})
Inserted 1 record(s) in 26ms
WriteResult({
  "nInserted": 1
})

Inserting using w:"ssd", where the members have identical values in the tags (i.e. both members have "ssd": "installed"):

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

This replica set tag semantics are counter-intuitive, and could be better explained in the docs. Some suggestions:

  • Explain that the key and value of replica set tags are both significant in terms of writeConcern.
  • Provide an example how writeConcern using custom tags could succeed or fail.


 Comments   
Comment by Githook User [ 12/Apr/17 ]

Author:

{u'username': u'kevinadi', u'name': u'Kevin Adistambha', u'email': u'kevinadi@gmail.com'}

Message: DOCS-10032 New section for tag set write concern behavior

Signed-off-by: kay <kay.kim@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/a353bf62db0d3c9852627ffbf5a24b9820c3e7cc

Generated at Thu Feb 08 07:59:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.