diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-06-06 10:45:06 +0300 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-06-09 13:13:05 -0400 |
commit | 2477b8c33b2e8f26fcde47c38c19c3fbb8b99839 (patch) | |
tree | da07b93547289dd370ba02434b0e82551dca9463 /jstests/sharding/migrateBig.js | |
parent | 3f7dce2ea7a4692380e04d09da89388c23133635 (diff) | |
download | mongo-2477b8c33b2e8f26fcde47c38c19c3fbb8b99839.tar.gz |
SERVER-22512 Remove unnecessary calls to stopBalancer
Diffstat (limited to 'jstests/sharding/migrateBig.js')
-rw-r--r-- | jstests/sharding/migrateBig.js | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/jstests/sharding/migrateBig.js b/jstests/sharding/migrateBig.js index 01260123b67..6166682bd83 100644 --- a/jstests/sharding/migrateBig.js +++ b/jstests/sharding/migrateBig.js @@ -1,64 +1,66 @@ (function() { + 'use strict'; var s = new ShardingTest({name: "migrateBig", shards: 2, other: {chunkSize: 1}}); - s.config.settings.update({_id: "balancer"}, {$set: {_waitForDelete: true}}, true); - s.adminCommand({enablesharding: "test"}); + assert.writeOK( + s.config.settings.update({_id: "balancer"}, {$set: {_waitForDelete: true}}, true)); + assert.commandWorked(s.s0.adminCommand({enablesharding: "test"})); s.ensurePrimaryShard('test', 'shard0001'); - s.adminCommand({shardcollection: "test.foo", key: {x: 1}}); + assert.commandWorked(s.s0.adminCommand({shardcollection: "test.foo", key: {x: 1}})); - db = s.getDB("test"); - coll = db.foo; + var db = s.getDB("test"); + var coll = db.foo; - big = ""; + var big = ""; while (big.length < 10000) big += "eliot"; var bulk = coll.initializeUnorderedBulkOp(); - for (x = 0; x < 100; x++) { + for (var x = 0; x < 100; x++) { bulk.insert({x: x, big: big}); } assert.writeOK(bulk.execute()); - s.printShardingStatus(); - - s.adminCommand({split: "test.foo", middle: {x: 30}}); - s.adminCommand({split: "test.foo", middle: {x: 66}}); - s.adminCommand( - {movechunk: "test.foo", find: {x: 90}, to: s.getOther(s.getPrimaryShard("test")).name}); + assert.commandWorked(s.s0.adminCommand({split: "test.foo", middle: {x: 30}})); + assert.commandWorked(s.s0.adminCommand({split: "test.foo", middle: {x: 66}})); + assert.commandWorked(s.s0.adminCommand( + {movechunk: "test.foo", find: {x: 90}, to: s.getOther(s.getPrimaryShard("test")).name})); s.printShardingStatus(); print("YO : " + s.getPrimaryShard("test").host); - direct = new Mongo(s.getPrimaryShard("test").host); + var direct = new Mongo(s.getPrimaryShard("test").host); print("direct : " + direct); - directDB = direct.getDB("test"); + var directDB = direct.getDB("test"); - for (done = 0; done < 2 * 1024 * 1024; done += big.length) { + for (var done = 0; done < 2 * 1024 * 1024; done += big.length) { assert.writeOK(directDB.foo.insert({x: 50 + Math.random(), big: big})); } s.printShardingStatus(); assert.throws(function() { - s.adminCommand( - {movechunk: "test.foo", find: {x: 50}, to: s.getOther(s.getPrimaryShard("test")).name}); + assert.commandWorked(s.s0.adminCommand({ + movechunk: "test.foo", + find: {x: 50}, + to: s.getOther(s.getPrimaryShard("test")).name + })); }, [], "move should fail"); - for (i = 0; i < 20; i += 2) { + for (var i = 0; i < 20; i += 2) { try { - s.adminCommand({split: "test.foo", middle: {x: i}}); + assert.commandWorked(s.s0.adminCommand({split: "test.foo", middle: {x: i}})); } catch (e) { - // we may have auto split on some of these - // which is ok + // We may have auto split on some of these, which is ok print(e); } } s.printShardingStatus(); - s.config.settings.update({_id: "balancer"}, {$set: {stopped: false}}, true); + s.startBalancer(); assert.soon(function() { var x = s.chunkDiff("foo", "test"); @@ -73,5 +75,4 @@ assert.eq(coll.count(), coll.find().itcount()); s.stop(); - })(); |