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

Version field for CSRS rs.initiate() without --replSet should default to 1

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.4
    • Component/s: Replication
    • Labels:
      None
    • Replication
    • ALL
      1. Start a node with --configsvr and without --replSet
      2. Connect in the shell and run rs.initiate() as above

      $ 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")
      	}
      }
      

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            joanna.cheng@mongodb.com Joanna Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: