diff options
Diffstat (limited to 'jstests/sharding/multi_coll_drop.js')
-rw-r--r-- | jstests/sharding/multi_coll_drop.js | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/jstests/sharding/multi_coll_drop.js b/jstests/sharding/multi_coll_drop.js index 076c39048f3..084577d8b27 100644 --- a/jstests/sharding/multi_coll_drop.js +++ b/jstests/sharding/multi_coll_drop.js @@ -1,44 +1,43 @@ // Tests the dropping and re-adding of a collection (function() { - var st = new ShardingTest({name: "multidrop", shards: 1, mongos: 2}); +var st = new ShardingTest({name: "multidrop", shards: 1, mongos: 2}); - var mA = st.s0; - var mB = st.s1; +var mA = st.s0; +var mB = st.s1; - var coll = mA.getCollection('multidrop.coll'); - var collB = mB.getCollection('multidrop.coll'); +var coll = mA.getCollection('multidrop.coll'); +var collB = mB.getCollection('multidrop.coll'); - jsTestLog("Shard and split collection..."); +jsTestLog("Shard and split collection..."); - var admin = mA.getDB("admin"); - assert.commandWorked(admin.runCommand({enableSharding: coll.getDB() + ""})); - assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}})); +var admin = mA.getDB("admin"); +assert.commandWorked(admin.runCommand({enableSharding: coll.getDB() + ""})); +assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}})); - for (var i = -100; i < 100; i++) { - assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}})); - } +for (var i = -100; i < 100; i++) { + assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}})); +} - jsTestLog("Create versioned connection for each mongos..."); +jsTestLog("Create versioned connection for each mongos..."); - assert.eq(0, coll.find().itcount()); - assert.eq(0, collB.find().itcount()); +assert.eq(0, coll.find().itcount()); +assert.eq(0, collB.find().itcount()); - jsTestLog("Dropping sharded collection..."); - assert(coll.drop()); +jsTestLog("Dropping sharded collection..."); +assert(coll.drop()); - jsTestLog("Recreating collection..."); +jsTestLog("Recreating collection..."); - assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}})); - for (var i = -10; i < 10; i++) { - assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}})); - } +assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}})); +for (var i = -10; i < 10; i++) { + assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}})); +} - jsTestLog("Retrying connections..."); +jsTestLog("Retrying connections..."); - assert.eq(0, coll.find().itcount()); - assert.eq(0, collB.find().itcount()); - - st.stop(); +assert.eq(0, coll.find().itcount()); +assert.eq(0, collB.find().itcount()); +st.stop(); })(); |