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

dropping a drop-pending collection via applyOps is a no-op

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0-rc1
    • Component/s: Replication
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      load('jstests/libs/write_concern_util.js');
      load('jstests/libs/uuid_util.js');
      var rst = new ReplSetTest({nodes: 2});
      rst.startSet();
      rst.initiate();
       
      var primary = rst.nodes[0];
      var secondary = rst.nodes[1];
       
      var db = primary.getDB('test');
      var collName = 'foo';
       
      stopReplicationOnSecondaries(rst);
       
      function printCollections() {
          printjson(db.runCommand({listCollections: 1, includePendingDrops: 1}));
      }
       
      assert.writeOK(db[collName].insert({a:1}));
      var uuid = getUUIDFromListCollections(db, collName);
       
      jsTestLog("Drop");
      printCollections();
      assert.commandWorked(db.runCommand({drop: collName}));
      printCollections();
      var cursor = db.runCommand({find: uuid});
      printjson(cursor);
      assert.eq(1, cursor.cursor.firstBatch.length);
       
      jsTestLog("Apply Ops with UUID on drop pending collection");
      printCollections();
      assert.commandWorked(primary.adminCommand({  "applyOps" : [ { "op" : "c", "ns" : "test.$cmd", "ui" : uuid, "o" : { "drop" : collName } } ] }));
      printCollections();
      cursor = db.runCommand({find: uuid});
      printjson(cursor);
      assert.eq(1, cursor.cursor.firstBatch.length);
      

      Show
      load('jstests/libs/write_concern_util.js'); load('jstests/libs/uuid_util.js'); var rst = new ReplSetTest({nodes: 2}); rst.startSet(); rst.initiate();   var primary = rst.nodes[0]; var secondary = rst.nodes[1];   var db = primary.getDB('test'); var collName = 'foo';   stopReplicationOnSecondaries(rst);   function printCollections() { printjson(db.runCommand({listCollections: 1, includePendingDrops: 1})); }   assert.writeOK(db[collName].insert({a:1})); var uuid = getUUIDFromListCollections(db, collName);   jsTestLog("Drop"); printCollections(); assert.commandWorked(db.runCommand({drop: collName})); printCollections(); var cursor = db.runCommand({find: uuid}); printjson(cursor); assert.eq(1, cursor.cursor.firstBatch.length);   jsTestLog("Apply Ops with UUID on drop pending collection"); printCollections(); assert.commandWorked(primary.adminCommand({ "applyOps" : [ { "op" : "c", "ns" : "test.$cmd", "ui" : uuid, "o" : { "drop" : collName } } ] })); printCollections(); cursor = db.runCommand({find: uuid}); printjson(cursor); assert.eq(1, cursor.cursor.firstBatch.length);
    • Sprint:
      Repl 2017-10-23

      Description

      If applyOps contains a drop operation on a drop pending collection's uuid, it currently drops the collection immediately. It should use the timestamp of the applyOps for two phase drop. This is required for rollback to complete successfully.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              benety.goh Benety Goh
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: