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

Slave can acknowledge write before initial sync is complete

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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();

      Description

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-repl Backlog - Replication Team
              Reporter:
              tess.avitabile Tess Avitabile
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: