[SERVER-23249] Version field for CSRS rs.initiate() without --replSet should default to 1 Created: 21/Mar/16  Updated: 06/Dec/22  Resolved: 20/Apr/20

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

Type: Bug Priority: Major - P3
Reporter: Joanna Cheng Assignee: Backlog - Replication Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Operating System: ALL
Steps To Reproduce:
  1. Start a node with --configsvr and without --replSet
  2. Connect in the shell and run rs.initiate() as above
Participants:

 Description   

$ mongo --port 27019
MongoDB shell version: 3.2.4
connecting to: 127.0.0.1:27019/test
configsvr> db.version()
3.2.4
configsvr> db.serverCmdLineOpts()
{
	"argv" : [
		"mongod",
		"--dbpath",
		"normal",
		"--configsvr"
	],
	"parsed" : {
		"sharding" : {
			"clusterRole" : "configsvr"
		},
		"storage" : {
			"dbPath" : "normal"
		}
	},
	"ok" : 1
}
configsvr> rs.initiate({ _id: "abc", configsvr: true, members: [{_id:0, host: "localhost:27019"}]})
{ "ok" : 0, "errmsg" : "Missing expected field \"version\"", "code" : 93 }
configsvr> rs.initiate({ _id: "abc", configsvr: true, members: [{_id:0, host: "localhost:27019"}], version: 1})
{ "ok" : 1 }

Compared to initiating a normal replica set

> rs.initiate({ _id: "abc", members: [{_id:0, host: "localhost:27017"}]})
{ "ok" : 1 }
abc:PRIMARY> rs.conf()
{
	"_id" : "abc",
>>>	"version" : 1,
	"protocolVersion" : NumberLong(1),
	"members" : [
		{
			"_id" : 0,
			"host" : "localhost:27017",
			"arbiterOnly" : false,
			"buildIndexes" : true,
			"hidden" : false,
			"priority" : 1,
			"tags" : {
 
			},
			"slaveDelay" : NumberLong(0),
			"votes" : 1
		}
	],
	"settings" : {
		"chainingAllowed" : true,
		"heartbeatIntervalMillis" : 2000,
		"heartbeatTimeoutSecs" : 10,
		"electionTimeoutMillis" : 10000,
		"getLastErrorModes" : {
 
		},
		"getLastErrorDefaults" : {
			"w" : 1,
			"wtimeout" : 0
		},
		"replicaSetId" : ObjectId("56ef4b1cb20cecc4830991bd")
	}
}



 Comments   
Comment by Githook User [ 05/Apr/16 ]

Author:

{u'username': u'joannac-', u'name': u'joannac-', u'email': u'joannac-@users.noreply.github.com'}

Message: Update upgrade-config-servers-to-replica-set.txt

Bug found and documented in SERVER-23249

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

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