...
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.
xgen-internal-githook commented on Wed, 18 Oct 2017 23:54:33 +0000: Author: {'email': 'benety@mongodb.com', 'name': 'Benety Goh', 'username': 'benety'} Message: SERVER-31488 dropping a drop-pending collection via applyOps is a no-op Branch: master https://github.com/mongodb/mongo/commit/c8455a590399a1cd6f963ab84ec236188bc3672a spencer commented on Wed, 11 Oct 2017 21:32:08 +0000: If they're already drop-pending, I think the applyOps drop should probably just return OK and be a no-op, the collection is logically already dropped. Presumably it's already tracked by the DropPendingCollectionReaper from whatever got it into drop-pending state to begin with benety.goh commented on Wed, 11 Oct 2017 18:28:21 +0000: applyOps allows dropping of system collections to support two phase drops for databases. See SERVER-29752. Perhaps the right thing to do here is to explicitly disallow dropping of drop-pending collections (whether they are referred to by UUID or system.drop... name).
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);