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

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc1
    • Affects Version/s: None
    • Component/s: 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

      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.

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

              Created:
              Updated:
              Resolved: