[DOCS-10286] rs.add should include _id in upgrade-config-servers-to-replica-set documentation Created: 19/May/17  Updated: 27/Oct/23  Resolved: 04/Dec/17

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

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Nicholas Larew
Resolution: Works as Designed Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.com/manual/tutorial/upgrade-config-servers-to-replica-set/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Referrer: https://docs.mongodb.com/manual/release-notes/3.4-upgrade-sharded-cluster/
Screen Resolution: 1440 x 900


Participants:
Days since reply: 6 years, 10 weeks, 2 days ago

 Description   

Here is a ticket to help fix the documentation to convert SCCC to CSRS, more specifically for rs.add step. Given the rs.add overloads

rs.add(hostportstr)
rs.add(membercfgobj)

Documentation was pointing to do statement similar to this
rs.add(

{ host: <host:port>, priority: 0, votes: 0 }

)

however, it threw an exception as below
csrsN2:PRIMARY> rs.add(

{ host: "ip-10-167-108-10:17309", priority: 0, votes: 0 }

)
{
"ok" : 0,
"errmsg" : "NoSuchKey: _id field is missing for member:

{ host: \"ip-10-167-108-10:17309\", priority: 0.0, votes: 0.0 }

",
"code" : 93,
"$gleStats" :

{ "lastOpTime" : Timestamp(0, 0), "electionId" : ObjectId("7fffffff0000000000000001") }

}

so I modified the add operation with _id as below and it did work.

rs.add(

{ _id: 1, host: "ip-10-167-108-10:17109", priority: 0, votes: 0 }

)
rs.add(

{ _id: 2, host: "ip-10-167-108-10:17209", priority: 0, votes: 0 }

)
rs.add(

{ _id: 3, host: "ip-10-167-108-10:17309", priority: 0, votes: 0 }

)
{
"ok" : 1,
"$gleStats" :

{ "lastOpTime" : Timestamp(1495216622, 3), "electionId" : ObjectId("7fffffff0000000000000001") }

}

rs.status()
csrsN2:PRIMARY> rs.status()
{
"set" : "csrsN2",
"date" : ISODate("2017-05-19T17:57:38.600Z"),
"myState" : 1,
"term" : NumberLong(1),
"configsvr" : true,
"heartbeatIntervalMillis" : NumberLong(2000),
"members" : [
{
"_id" : 0,
"name" : "ip-10-167-108-10:17119",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 1126,
"optime" :

{ "ts" : Timestamp(1495216655, 2), "t" : NumberLong(1) }

,
"optimeDate" : ISODate("2017-05-19T17:57:35Z"),
"electionTime" : Timestamp(1495215532, 1),
"electionDate" : ISODate("2017-05-19T17:38:52Z"),
"configVersion" : 4,
"self" : true
},
{
"_id" : 1,
"name" : "ip-10-167-108-10:17109",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 35,
"optime" :

{ "ts" : Timestamp(1495216655, 2), "t" : NumberLong(1) }

,
"optimeDate" : ISODate("2017-05-19T17:57:35Z"),
"lastHeartbeat" : ISODate("2017-05-19T17:57:36.884Z"),
"lastHeartbeatRecv" : ISODate("2017-05-19T17:57:37.897Z"),
"pingMs" : NumberLong(0),
"syncingTo" : "ip-10-167-108-10:17119",
"configVersion" : 4
},
{
"_id" : 2,
"name" : "ip-10-167-108-10:17209",
"health" : 0,
"state" : 8,
"stateStr" : "(not reachable/healthy)",
"uptime" : 0,
"optime" :

{ "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

,
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"lastHeartbeat" : ISODate("2017-05-19T17:57:36.895Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "not running with --replSet",
"configVersion" : -1
},
{
"_id" : 3,
"name" : "ip-10-167-108-10:17309",
"health" : 0,
"state" : 8,
"stateStr" : "(not reachable/healthy)",
"uptime" : 0,
"optime" :

{ "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

,
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"lastHeartbeat" : ISODate("2017-05-19T17:57:36.895Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "not running with --replSet",
"configVersion" : -1
}
],
"ok" : 1,
"$gleStats" :

{ "lastOpTime" : Timestamp(1495216622, 3), "electionId" : ObjectId("7fffffff0000000000000001") }

}

Reporter: Shyam Arjarapu
E-mail: shyam@mongodb.com



 Comments   
Comment by Nicholas Larew [ 04/Dec/17 ]

The config server SCCC -> CSRS tutorial specifies that all upgrades need to be from v3.2.4. In v3.0.0 the _id field was made optional on host documents for rs.add() which is also documented.

Generated at Thu Feb 08 08:00:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.