summaryrefslogtreecommitdiff
path: root/jstests/sharding/merge_chunks_test_with_md_ops.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/sharding/merge_chunks_test_with_md_ops.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/merge_chunks_test_with_md_ops.js')
-rw-r--r--jstests/sharding/merge_chunks_test_with_md_ops.js74
1 files changed, 36 insertions, 38 deletions
diff --git a/jstests/sharding/merge_chunks_test_with_md_ops.js b/jstests/sharding/merge_chunks_test_with_md_ops.js
index ddcdfbaf0c2..591413a109c 100644
--- a/jstests/sharding/merge_chunks_test_with_md_ops.js
+++ b/jstests/sharding/merge_chunks_test_with_md_ops.js
@@ -1,57 +1,55 @@
// Tests that merging chunks does not prevent cluster from doing other metadata ops
(function() {
-'use strict';
+ 'use strict';
-var st = new ShardingTest({ shards: 2 });
+ var st = new ShardingTest({shards: 2});
-var mongos = st.s0;
-var admin = mongos.getDB("admin");
-var shards = mongos.getCollection("config.shards").find().toArray();
-var coll = mongos.getCollection("foo.bar");
+ var mongos = st.s0;
+ var admin = mongos.getDB("admin");
+ var shards = mongos.getCollection("config.shards").find().toArray();
+ var coll = mongos.getCollection("foo.bar");
-assert.commandWorked(admin.runCommand({ enableSharding: coll.getDB() + "" }));
-st.ensurePrimaryShard(coll.getDB() + "", shards[0]._id);
-assert.commandWorked(admin.runCommand({ shardCollection: coll + "", key: { _id: 1 } }));
+ assert.commandWorked(admin.runCommand({enableSharding: coll.getDB() + ""}));
+ st.ensurePrimaryShard(coll.getDB() + "", shards[0]._id);
+ assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}}));
-st.printShardingStatus();
+ st.printShardingStatus();
-// Split and merge the first chunk repeatedly
-jsTest.log("Splitting and merging repeatedly...");
+ // Split and merge the first chunk repeatedly
+ jsTest.log("Splitting and merging repeatedly...");
-for (var i = 0; i < 5; i++) {
- assert.commandWorked(admin.runCommand({ split: coll + "", middle: { _id: i } }));
- assert.commandWorked(admin.runCommand({ mergeChunks: coll + "",
- bounds: [ { _id: MinKey }, { _id: MaxKey } ] }));
- printjson(mongos.getDB("config").chunks.find().toArray());
-}
+ for (var i = 0; i < 5; i++) {
+ assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}}));
+ assert.commandWorked(
+ admin.runCommand({mergeChunks: coll + "", bounds: [{_id: MinKey}, {_id: MaxKey}]}));
+ printjson(mongos.getDB("config").chunks.find().toArray());
+ }
-// Move the first chunk to the other shard
-jsTest.log("Moving to another shard...");
+ // Move the first chunk to the other shard
+ jsTest.log("Moving to another shard...");
-assert.commandWorked(admin.runCommand({ moveChunk: coll + "",
- find: { _id: 0 },
- to: shards[1]._id }));
+ assert.commandWorked(
+ admin.runCommand({moveChunk: coll + "", find: {_id: 0}, to: shards[1]._id}));
-// Split and merge the chunk repeatedly
-jsTest.log("Splitting and merging repeatedly (again)...");
+ // Split and merge the chunk repeatedly
+ jsTest.log("Splitting and merging repeatedly (again)...");
-for (var i = 0; i < 5; i++) {
- assert.commandWorked(admin.runCommand({ split: coll + "", middle: { _id: i } }));
- assert.commandWorked(admin.runCommand({ mergeChunks: coll + "",
- bounds: [{ _id: MinKey }, { _id: MaxKey }] }));
- printjson(mongos.getDB("config").chunks.find().toArray());
-}
+ for (var i = 0; i < 5; i++) {
+ assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: i}}));
+ assert.commandWorked(
+ admin.runCommand({mergeChunks: coll + "", bounds: [{_id: MinKey}, {_id: MaxKey}]}));
+ printjson(mongos.getDB("config").chunks.find().toArray());
+ }
-// Move the chunk back to the original shard
-jsTest.log("Moving to original shard...");
+ // Move the chunk back to the original shard
+ jsTest.log("Moving to original shard...");
-assert.commandWorked(admin.runCommand({ moveChunk: coll + "",
- find: { _id: 0 },
- to: shards[0]._id }));
+ assert.commandWorked(
+ admin.runCommand({moveChunk: coll + "", find: {_id: 0}, to: shards[0]._id}));
-st.printShardingStatus();
+ st.printShardingStatus();
-st.stop();
+ st.stop();
})();