summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-04-28 07:57:57 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-04-29 10:45:58 -0400
commite1ca46b045b85aaf546eb831448712db0de69b73 (patch)
tree48adb08a2c5e9e9ecec806f7771b3a548ed2010f /jstests
parentdff63f2afc63ee0b4e3288f50d435af83995e370 (diff)
downloadmongo-e1ca46b045b85aaf546eb831448712db0de69b73.tar.gz
SERVER-22667 Balancer chunk selection policy interface
This interface is responsible for combining information of the shard utilization and the chunk distribution and providing a list of chunks, which need to be moved around. By abstracting this logic behind an interface, we can mock it and test the actual chunk moves. No functional changes.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/jumbo1.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/jstests/sharding/jumbo1.js b/jstests/sharding/jumbo1.js
index 1e8a3a9fdb2..594c8165ab2 100644
--- a/jstests/sharding/jumbo1.js
+++ b/jstests/sharding/jumbo1.js
@@ -1,39 +1,40 @@
(function() {
+ 'use strict';
- var s = new ShardingTest({name: "jumbo1", shards: 2, mongos: 1, other: {chunkSize: 1}});
+ var s = new ShardingTest({shards: 2, mongos: 1, other: {chunkSize: 1}});
- s.adminCommand({enablesharding: "test"});
+ 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");
+ var db = s.getDB("test");
- big = "";
- while (big.length < 10000)
+ var big = "";
+ while (big.length < 10000) {
big += ".";
+ }
- x = 0;
+ var x = 0;
var bulk = db.foo.initializeUnorderedBulkOp();
- for (; x < 500; x++)
+ for (; x < 500; x++) {
bulk.insert({x: x, big: big});
+ }
- for (i = 0; i < 500; i++)
+ for (var i = 0; i < 500; i++) {
bulk.insert({x: x, big: big});
+ }
- for (; x < 2000; x++)
+ for (; x < 2000; x++) {
bulk.insert({x: x, big: big});
+ }
assert.writeOK(bulk.execute());
s.printShardingStatus(true);
-
- res = sh.moveChunk("test.foo", {x: 0}, "shard0001");
- if (!res.ok)
- res = sh.moveChunk("test.foo", {x: 0}, "shard0000");
-
+ assert.commandWorked(s.s0.adminCommand({moveChunk: 'test.foo', find: {x: 0}, to: 'shard0000'}));
s.printShardingStatus(true);
- sh.setBalancerState(true);
+ s.startBalancer();
function diff1() {
var x = s.chunkCounts("foo");