summaryrefslogtreecommitdiff
path: root/jstests/sharding/sharding_balance2.js
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-06-29 11:13:09 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-06-29 15:00:16 -0400
commit7f736859d32f9237aa382a676644082a9f66a45d (patch)
treec083e482de7f58f30ff854fcc76d5525c85f3eaa /jstests/sharding/sharding_balance2.js
parentb65ddcd7868eecdec66255cae14596c479e5d316 (diff)
downloadmongo-7f736859d32f9237aa382a676644082a9f66a45d.tar.gz
SERVER-24720/SERVER-24782 Move serverStatus.balancer to a balancerStatus command
This change gets rid of the serverStatus.balancer section and moves its functionality to a new balancer command called 'balancerStatus'. In addition it gets rid of the 'controlBalancer' command and splits it into two commands - balancerStart and balancerStop.
Diffstat (limited to 'jstests/sharding/sharding_balance2.js')
-rw-r--r--jstests/sharding/sharding_balance2.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/jstests/sharding/sharding_balance2.js b/jstests/sharding/sharding_balance2.js
index 37c84ed8ded..7de9a97aa3e 100644
--- a/jstests/sharding/sharding_balance2.js
+++ b/jstests/sharding/sharding_balance2.js
@@ -1,24 +1,21 @@
/**
* Test the maxSize setting for the addShard command.
*/
-
(function() {
- "use strict";
+ 'use strict';
var MaxSizeMB = 1;
var s = new ShardingTest({shards: 2, other: {chunkSize: 1, manualAddShard: true}});
var db = s.getDB("test");
- s.stopBalancer();
var names = s.getConnNames();
assert.eq(2, names.length);
- s.adminCommand({addshard: names[0]});
- s.adminCommand({addshard: names[1], maxSize: MaxSizeMB});
+ assert.commandWorked(s.s0.adminCommand({addshard: names[0]}));
+ assert.commandWorked(s.s0.adminCommand({addshard: names[1], maxSize: MaxSizeMB}));
- s.adminCommand({enablesharding: "test"});
- var res = db.adminCommand({movePrimary: 'test', to: names[0]});
- assert(res.ok || res.errmsg == "it is already the primary");
+ assert.commandWorked(s.s0.adminCommand({enablesharding: "test"}));
+ s.ensurePrimaryShard('test', names[0]);
var bigString = "";
while (bigString.length < 10000)
@@ -32,7 +29,8 @@
inserted += bigString.length;
}
assert.writeOK(bulk.execute());
- s.adminCommand({shardcollection: "test.foo", key: {_id: 1}});
+
+ assert.commandWorked(s.s0.adminCommand({shardcollection: "test.foo", key: {_id: 1}}));
assert.gt(s.config.chunks.count(), 10);
var getShardSize = function(conn) {
@@ -63,13 +61,10 @@
}
s.startBalancer();
-
- // Wait until balancer finishes at least one balancing round.
- assert(s.waitForBalancerRound(), "Balancer is not running: it never pinged config.mongos");
+ s.awaitBalancerRound();
var chunkCounts = s.chunkCounts('foo', 'test');
assert.eq(0, chunkCounts.shard0001);
s.stop();
-
})();