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

Replica set secondary allows rs.initiate() while performing initial sync

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.11, 2.6.8, 3.0.1
    • Component/s: Replication
    • None
    • ALL
    • Hide

      See above.

      Show
      See above.

      Scenario:

      Create RS with two data nodes (A,B) and an arbiter.
      Give A priority 2, B priority 1 -> A becomes primary
      Kill A process -> B (with lower priority) becomes primary
      Delete all data files from A
      Connect to B and add data:

      for (var i = 1; i <= 200000; i++) { db.testData.insert( { x : i } ) }
      db.copyDatabase("test", "test1” )
      db.copyDatabase("test", "test2” )
      etc.
      

      The idea is to make initial sync take some time.

      Start A process as follows:

      mongod --replSet replset --dbpath <path> --logpath <path>/mongod.log --port <port> --logappend --fork ; mongo --port <port> --eval "printjson(rs.initiate())"
      

      This will start A, which will come up and start initial sync. rs.initiate() command will run while initial sync is taking place. Command should fail, but it will succeed.

      mongod --replSet replset --dbpath /Users/ericsommer/data/301rs/replset/rs2/db --logpath /Users/ericsommer/data/301rs/replset/rs2/mongod.log --port 30001 --logappend --fork ; mongo --port 30001 --eval "printjson(rs.initiate())"
      about to fork child process, waiting until server is ready for connections.
      forked process: 7005
      child process started successfully, parent exiting
      MongoDB shell version: 3.0.1
      connecting to: 127.0.0.1:30001/test
      {
      	"info2" : "no configuration explicitly specified -- making one",
      	"me" : "Erics-MBP.home:30001",
      	"ok" : 1
      }
      

      Command doesn’t succeed if:

      • mongod reaches secondary state before rs.initiate() is called
      • with default priorities

      See attached log mongodb.debug.log from node A.

      Customer found bug in 2.4.11. Tested with 3.0.1 and 2.6.8 – same behavior.

            Assignee:
            Unassigned Unassigned
            Reporter:
            eric.sommer@mongodb.com Eric Sommer
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: