Created
April 1, 2014 23:07
-
-
Save rueckstiess/9924918 to your computer and use it in GitHub Desktop.
SERVER-12638 repro.js (shorter)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clusterConfig = { shards : 3, | |
mongos : 3, | |
config : 1 }; | |
var st = new ShardingTest(clusterConfig); | |
var mongos = st.s; | |
function createShardedCollections(collName, dbName, mongosHost) { | |
var mongos = new Mongo(mongosHost); | |
var i = 0; | |
assert.commandWorked(mongos.adminCommand({ enableSharding : dbName + "_" + i })); | |
assert.commandWorked(mongos.adminCommand({ shardcollection : dbName + "_" + i + "." + "collection", | |
key : { _id : "hashed" }, | |
numInitialChunks : 15 })); | |
} | |
function parallelCreateShardedCollections(baseName, nthreads) { | |
var i = 0; | |
var threads = []; | |
for (i = 0; i < nthreads; ++i) { | |
var collName = baseName + "_"; | |
var dbName = baseName + "_" + i; | |
threads[i] = new Thread(createShardedCollections, collName, dbName, mongos.host); | |
} | |
for (i = 0; i < nthreads; ++i) { | |
threads[i].start(); | |
} | |
for (i = 0; i < nthreads; ++i) { | |
threads[i].join(); | |
} | |
return true; | |
} | |
jsTest.log("Disabling balancer"); | |
st.stopBalancer(); | |
// mongos.getDB("config").settings.update({ _id: "balancer" }, { $set : { stopped : true } }); | |
jsTest.log("Creating collections"); | |
parallelCreateShardedCollections("basename", 10); | |
sleep(900000); | |
st.stop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment