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

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.6.0-rc1
    • Replication
    • Fully Compatible
    • ALL
    • 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);
    • 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

              benety.goh@mongodb.com Benety Goh
              judah.schvimer@mongodb.com Judah Schvimer
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: