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

Calling rs.initiate() on 2 nodes when setting up replica set results in two primaries

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.0
    • Component/s: None
    • None
    • ALL

      • Start mongod on 2 nodes
      • login to node1 and call rs.initiate()
      • login to node2 and call rs.initiate() and rs.add('<node1>:<port>')

      Now rs.status() shows 2 primaries.

      It should probably not allow this, or warn before adding the other node, and require a parameter (force: true), and undo the other rs.initiate().

      rs:PRIMARY> rs.status()
      {
      	"set" : "thomas",
      	"date" : ISODate("2012-10-25T22:20:35Z"),
      	"myState" : 1,
      	"members" : [
      		{
      			"_id" : 0,
      			"name" : "capslock.local:27018",
      			"health" : 1,
      			"state" : 1,
      			"stateStr" : "PRIMARY",
      			"uptime" : 50,
      			"optime" : Timestamp(1351203632000, 1),
      			"optimeDate" : ISODate("2012-10-25T22:20:32Z"),
      			"self" : true
      		},
      		{
      			"_id" : 1,
      			"name" : "capslock.local:27017",
      			"health" : 1,
      			"state" : 1,
      			"stateStr" : "PRIMARY",
      			"uptime" : 3,
      			"optime" : Timestamp(1351203598000, 1),
      			"optimeDate" : ISODate("2012-10-25T22:19:58Z"),
      			"lastHeartbeat" : ISODate("2012-10-25T22:20:34Z"),
      			"pingMs" : 0
      		}
      	],
      	"ok" : 1
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: