diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-12-30 18:53:44 -0500 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-12-31 11:26:08 -0500 |
commit | c1670374064602ea8d76417572a7226aa9f918c8 (patch) | |
tree | 1db5c7a79a0c1f235e28e04fa3e98d6ea08388b3 /jstests/noPassthroughWithMongod | |
parent | 6216c1f39ca10f148a82cb2b9bba0bd2b61c8793 (diff) | |
download | mongo-c1670374064602ea8d76417572a7226aa9f918c8.tar.gz |
SERVER-38301 Improve racy indexbg_drop.js test
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r-- | jstests/noPassthroughWithMongod/indexbg_drop.js | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/jstests/noPassthroughWithMongod/indexbg_drop.js b/jstests/noPassthroughWithMongod/indexbg_drop.js deleted file mode 100644 index 738119f578c..00000000000 --- a/jstests/noPassthroughWithMongod/indexbg_drop.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * TODO: SERVER-38301 - * This tests inserts a huge number of documents, initiates a background index build - * and tries to perform another task in parallel while the background index task is - * active. The problem is that this is timing dependent and the current test setup - * tries to achieve this by inserting insane amount of documents. - * @tags: [requires_replication] - */ - -// Index drop race - -load('jstests/noPassthrough/libs/index_build.js'); - -var dbname = 'dropbgindex'; -var collection = 'jstests_feh'; -var size = 500000; - -// Set up replica set -var replTest = new ReplSetTest({name: 'bgIndex', nodes: 3}); -var nodes = replTest.nodeList(); -printjson(nodes); - -// We need an arbiter to ensure that the primary doesn't step down when we restart the secondary -replTest.startSet(); -replTest.initiate({ - "_id": "bgIndex", - "members": [ - {"_id": 0, "host": nodes[0]}, - {"_id": 1, "host": nodes[1]}, - {"_id": 2, "host": nodes[2], "arbiterOnly": true} - ] -}); - -var master = replTest.getPrimary(); -var second = replTest.getSecondary(); - -var masterId = replTest.getNodeId(master); -var secondId = replTest.getNodeId(second); - -var masterDB = master.getDB(dbname); -var secondDB = second.getDB(dbname); - -var dc = {dropIndexes: collection, index: "i_1"}; - -// set up collections -masterDB.dropDatabase(); -jsTest.log("creating test data " + size + " documents"); -Random.setRandomSeed(); -var bulk = masterDB.getCollection(collection).initializeUnorderedBulkOp(); -for (i = 0; i < size; ++i) { - bulk.insert({i: Random.rand()}); -} -assert.writeOK(bulk.execute({w: 2, wtimeout: replTest.kDefaultTimeoutMS})); - -jsTest.log("Starting background indexing for test of: " + tojson(dc)); -// Add another index to be sure the drop command works. -masterDB.getCollection(collection).ensureIndex({b: 1}); - -masterDB.getCollection(collection).ensureIndex({i: 1}, {background: true}); - -// make sure the index build has started on secondary -IndexBuildTest.waitForIndexBuildToStart(secondDB); - -jsTest.log("dropping index"); -masterDB.runCommand({dropIndexes: collection, index: "*"}); -jsTest.log("Waiting on replication"); -replTest.awaitReplication(); - -print("index list on master:"); -masterDB.getCollection(collection).getIndexes().forEach(printjson); - -// we need to assert.soon because the drop only marks the index for removal -// the removal itself is asynchronous and may take another moment before it happens -var i = 0; -assert.soon(function() { - print("index list on secondary (run " + i + "):"); - secondDB.getCollection(collection).getIndexes().forEach(printjson); - - i++; - return 1 === secondDB.getCollection(collection).getIndexes().length; -}, "secondary did not drop index"); - -replTest.stopSet(); |