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

can't start usable mongos if replSet shard lacks a master

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

      queries with slaveOk fail with error:

      { "$err" : "socket exception", "code" : 11002 }

      Once enough members are up to have a master, all requests succeed, even if you bring the replSet down to a single working member. I think this is related to the WriteBack command but am not sure yet.

      var st = new ShardingTest({ shards: { rs0: { nodes: 2, oplogSize: 2 }}, mongos : 0, });
      var replTest = st.rs0;
      replTest.awaitSecondaryNodes();
      printjson(replTest.status());
      
      print("Starting a mongos while replSet is intact")
      var ports = allocatePorts(2);
      var s1 = startMongos( { port : ports[0], v : 0, configdb : st._configDB } );
      
      print("query the config db with readPref secondary");
      assert.eq(s1.getDB("config").settings.find().readPref("secondary").count(), 1); 
      
      print("Stopping the primary");
      replTest.stopMaster();
      sleep(3);
      printjson(replTest.status());
      
      print("Starting a mongos with no primary in shard");
      var s2 = startMongos( { port : ports[1], v : 0, configdb : st._configDB } );
      print("Query the config db with readPref secondary");
      assert.eq(s2.getDB("config").settings.find().readPref("secondary").count(), 1, 'failed to query the config db');
      

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: