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

Dropped write during insert loop with retry_writes on

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • ALL
    • Hide

      1. Start a MongoDB 3.6.2 replica set with FCV 3.6
      2. Start a loop in the mongo shell to insert 10,000 documents with retry_writes set to true:

      use test
      db = db.getMongo().startSession({retry_writes: true}).getDatabase(db.getName());
      for (i = 0; i < 10000; i++) { db.test.insert({}); }
      

      3. While the inserts are happening issue an rs.stepDown() command on the primary
      4. The insert loop will eventually finish but db.test.count() will indicate that only 9,999 documents have been inserted.

      Show
      1. Start a MongoDB 3.6.2 replica set with FCV 3.6 2. Start a loop in the mongo shell to insert 10,000 documents with retry_writes set to true: use test db = db.getMongo().startSession({retry_writes: true}).getDatabase(db.getName()); for (i = 0; i < 10000; i++) { db.test.insert({}); } 3. While the inserts are happening issue an rs.stepDown() command on the primary 4. The insert loop will eventually finish but db.test.count() will indicate that only 9,999 documents have been inserted.

      max.hirschhorn suggested I file this ticket.

      If I start a an insert loop that attempts to insert 10,000 documents with retry_writes on and then step down the primary only 9,999 documents are inserted.

      MongoDB is running with FCV 3.6.

        1. new-primary.log
          22 kB
        2. old-primary.log
          28 kB

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            tim.olsen@mongodb.com Timothy Olsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: