summaryrefslogtreecommitdiff
path: root/jstests/sharding/major_version_check.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/major_version_check.js')
-rw-r--r--jstests/sharding/major_version_check.js90
1 files changed, 45 insertions, 45 deletions
diff --git a/jstests/sharding/major_version_check.js b/jstests/sharding/major_version_check.js
index 546d9eb0c33..baa01aa7966 100644
--- a/jstests/sharding/major_version_check.js
+++ b/jstests/sharding/major_version_check.js
@@ -2,67 +2,67 @@
// Tests that only a correct major-version is needed to connect to a shard via mongos
//
(function() {
- 'use strict';
+'use strict';
- var st = new ShardingTest({shards: 1, mongos: 2});
+var st = new ShardingTest({shards: 1, mongos: 2});
- var mongos = st.s0;
- var staleMongos = st.s1;
- var admin = mongos.getDB("admin");
- var config = mongos.getDB("config");
- var coll = mongos.getCollection("foo.bar");
+var mongos = st.s0;
+var staleMongos = st.s1;
+var admin = mongos.getDB("admin");
+var config = mongos.getDB("config");
+var coll = mongos.getCollection("foo.bar");
- // Shard collection
- assert.commandWorked(admin.runCommand({enableSharding: coll.getDB() + ""}));
- assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}}));
+// Shard collection
+assert.commandWorked(admin.runCommand({enableSharding: coll.getDB() + ""}));
+assert.commandWorked(admin.runCommand({shardCollection: coll + "", key: {_id: 1}}));
- // Make sure our stale mongos is up-to-date with no splits
- staleMongos.getCollection(coll + "").findOne();
+// Make sure our stale mongos is up-to-date with no splits
+staleMongos.getCollection(coll + "").findOne();
- // Run one split
- assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: 0}}));
+// Run one split
+assert.commandWorked(admin.runCommand({split: coll + "", middle: {_id: 0}}));
- // Make sure our stale mongos is not up-to-date with the split
- printjson(admin.runCommand({getShardVersion: coll + ""}));
- printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
+// Make sure our stale mongos is not up-to-date with the split
+printjson(admin.runCommand({getShardVersion: coll + ""}));
+printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
- // Compare strings b/c timestamp comparison is a bit weird
- assert.eq(Timestamp(2, 2), admin.runCommand({getShardVersion: coll + ""}).version);
- assert.eq(Timestamp(1, 0),
- staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
+// Compare strings b/c timestamp comparison is a bit weird
+assert.eq(Timestamp(2, 2), admin.runCommand({getShardVersion: coll + ""}).version);
+assert.eq(Timestamp(1, 0),
+ staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
- // See if our stale mongos is required to catch up to run a findOne on an existing connection
- staleMongos.getCollection(coll + "").findOne();
+// See if our stale mongos is required to catch up to run a findOne on an existing connection
+staleMongos.getCollection(coll + "").findOne();
- printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
+printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
- assert.eq(Timestamp(1, 0),
- staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
+assert.eq(Timestamp(1, 0),
+ staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
- // See if our stale mongos is required to catch up to run a findOne on a new connection
- staleMongos = new Mongo(staleMongos.host);
- staleMongos.getCollection(coll + "").findOne();
+// See if our stale mongos is required to catch up to run a findOne on a new connection
+staleMongos = new Mongo(staleMongos.host);
+staleMongos.getCollection(coll + "").findOne();
- printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
+printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
- assert.eq(Timestamp(1, 0),
- staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
+assert.eq(Timestamp(1, 0),
+ staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
- // Run another split on the original chunk, which does not exist anymore (but the stale mongos
- // thinks it exists). This should fail and cause a refresh on the shard, updating its shard
- // version.
- assert.commandFailed(staleMongos.getDB("admin").runCommand(
- {split: coll + "", bounds: [{_id: MinKey}, {_id: MaxKey}]}));
+// Run another split on the original chunk, which does not exist anymore (but the stale mongos
+// thinks it exists). This should fail and cause a refresh on the shard, updating its shard
+// version.
+assert.commandFailed(staleMongos.getDB("admin").runCommand(
+ {split: coll + "", bounds: [{_id: MinKey}, {_id: MaxKey}]}));
- // This findOne will cause a refresh on the router since the shard version has now been
- // increased.
- staleMongos.getCollection(coll + "").findOne();
+// This findOne will cause a refresh on the router since the shard version has now been
+// increased.
+staleMongos.getCollection(coll + "").findOne();
- printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
+printjson(staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}));
- // The previously stale mongos should now be up-to-date.
- assert.eq(Timestamp(2, 2),
- staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
+// The previously stale mongos should now be up-to-date.
+assert.eq(Timestamp(2, 2),
+ staleMongos.getDB("admin").runCommand({getShardVersion: coll + ""}).version);
- st.stop();
+st.stop();
})();