summaryrefslogtreecommitdiff
path: root/jstests/sharding/fair_balancer_round.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/fair_balancer_round.js')
-rw-r--r--jstests/sharding/fair_balancer_round.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/jstests/sharding/fair_balancer_round.js b/jstests/sharding/fair_balancer_round.js
index 8373d6fb0d6..90fc345c8cb 100644
--- a/jstests/sharding/fair_balancer_round.js
+++ b/jstests/sharding/fair_balancer_round.js
@@ -2,9 +2,11 @@
// Tests that a balancer round loads newly sharded collection data
//
-var options = {mongosOptions : {verbose : 1}};
+var options = {
+ mongosOptions: {verbose: 1}
+};
-var st = new ShardingTest({shards : 2, mongos : 2, other : options});
+var st = new ShardingTest({shards: 2, mongos: 2, other: options});
// Stop balancer initially
st.stopBalancer();
@@ -14,27 +16,26 @@ var staleMongos = st.s1;
var coll = mongos.getCollection("foo.bar");
// Shard collection through first mongos
-assert(mongos.adminCommand({enableSharding : coll.getDB() + ""}).ok);
+assert(mongos.adminCommand({enableSharding: coll.getDB() + ""}).ok);
st.ensurePrimaryShard(coll.getDB().getName(), 'shard0001');
-assert(mongos.adminCommand({shardCollection : coll + "", key : {_id : 1}}).ok);
+assert(mongos.adminCommand({shardCollection: coll + "", key: {_id: 1}}).ok);
// Create a bunch of chunks
var numSplits = 20;
-for ( var i = 0; i < numSplits; i++) {
- assert(mongos.adminCommand({split : coll + "", middle : {_id : i}}).ok);
+for (var i = 0; i < numSplits; i++) {
+ assert(mongos.adminCommand({split: coll + "", middle: {_id: i}}).ok);
}
// Stop the first mongos who setup the cluster.
st.stopMongos(0);
// Start balancer, which lets the stale mongos balance
-assert.writeOK(staleMongos.getDB("config").settings.update({_id: "balancer"},
- {$set: {stopped: false}},
- true));
+assert.writeOK(staleMongos.getDB("config")
+ .settings.update({_id: "balancer"}, {$set: {stopped: false}}, true));
// Make sure we eventually start moving chunks
assert.soon(function() {
- return staleMongos.getCollection("config.changelog").count({what : /moveChunk/}) > 0;
+ return staleMongos.getCollection("config.changelog").count({what: /moveChunk/}) > 0;
}, "no balance happened", 5 * 60 * 1000);
jsTest.log("DONE!");