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

Slave can acknowledge write before initial sync is complete

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Replication
    • ALL
    • Hide
      var rt = new ReplTest();
      var master = rt.start(true);
      
      var slave = rt.start(false);
      
      for (var i = 1; i <= 20; i++) {
          master.getDB("test").createCollection("coll" + i);
      }
      
      assert.writeOK(master.getDB("test").coll0.insert({}, {writeConcern: {w: 2}}));
      
      for (var i = 0; i <= 20; i++) {
          var res = slave.getDB("test").runCommand({listCollections: 1, filter: {name: "coll" + i}});
          // This fails for some collections.
          assert.eq(res.cursor.firstBatch.length, 1, "collection coll" + i + " not found");
      }
      
      rt.stop();
      
      Show
      var rt = new ReplTest(); var master = rt.start( true ); var slave = rt.start( false ); for ( var i = 1; i <= 20; i++) { master.getDB( "test" ).createCollection( "coll" + i); } assert.writeOK(master.getDB( "test" ).coll0.insert({}, {writeConcern: {w: 2}})); for ( var i = 0; i <= 20; i++) { var res = slave.getDB( "test" ).runCommand({listCollections: 1, filter: {name: "coll" + i}}); // This fails for some collections. assert.eq(res.cursor.firstBatch.length, 1, "collection coll" + i + " not found" ); } rt.stop();

      This behavior means that we cannot use {w:2} writes to tell whether a slave has completed initial sync.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: