diff options
Diffstat (limited to 'jstests/replsets/apply_ops_create_indexes.js')
-rw-r--r-- | jstests/replsets/apply_ops_create_indexes.js | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/jstests/replsets/apply_ops_create_indexes.js b/jstests/replsets/apply_ops_create_indexes.js index ebeffbb1593..e3641965ce6 100644 --- a/jstests/replsets/apply_ops_create_indexes.js +++ b/jstests/replsets/apply_ops_create_indexes.js @@ -7,54 +7,6 @@ load('jstests/noPassthrough/libs/index_build.js'); -let ensureIndexExists = function(testDB, collName, indexName, expectedNumIndexes) { - let cmd = {listIndexes: collName}; - let res = testDB.runCommand(cmd); - assert.commandWorked(res, "could not run " + tojson(cmd)); - let indexes = new DBCommandCursor(testDB, res).toArray(); - - assert.eq(indexes.length, expectedNumIndexes); - - let foundIndex = false; - for (let i = 0; i < indexes.length; ++i) { - if (indexes[i].name == indexName) { - foundIndex = true; - } - } - assert(foundIndex, - "did not find the index '" + indexName + - "' amongst the collection indexes: " + tojson(indexes)); -}; - -let ensureOplogEntryExists = function(localDB, indexName) { - // Make sure the oplog entry for index creation exists in the oplog. - let cmd = {find: "oplog.rs"}; - let res = localDB.runCommand(cmd); - assert.commandWorked(res, "could not run " + tojson(cmd)); - let cursor = new DBCommandCursor(localDB, res); - let errMsg = "expected more data from command " + tojson(cmd) + ", with result " + tojson(res); - assert(cursor.hasNext(), errMsg); - let oplog = localDB.getCollection("oplog.rs"); - - // If two phase index builds are enabled, index creation will show up in the oplog as a pair of - // startIndexBuild and commitIndexBuild oplog entries rather than a single createIndexes entry. - let query = { - $and: [ - {"o.startIndexBuild": {$exists: true}}, - {"o.indexes.0.name": indexName}, - ], - }; - let resCursor = oplog.find(query); - assert.eq(resCursor.count(), - 1, - "Expected the query " + tojson(query) + " to return exactly 1 document"); - query = {$and: [{"o.commitIndexBuild": {$exists: true}}, {"o.indexes.0.name": indexName}]}; - resCursor = oplog.find(query); - assert.eq(resCursor.count(), - 1, - "Expected the query " + tojson(query) + " to return exactly 1 document"); -}; - let rst = new ReplSetTest({nodes: 3}); rst.startSet(); rst.initiate(); |