summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/libs/multi_cluster.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/multiVersion/libs/multi_cluster.js')
-rw-r--r--jstests/multiVersion/libs/multi_cluster.js64
1 files changed, 31 insertions, 33 deletions
diff --git a/jstests/multiVersion/libs/multi_cluster.js b/jstests/multiVersion/libs/multi_cluster.js
index cf60f531307..5d98f942546 100644
--- a/jstests/multiVersion/libs/multi_cluster.js
+++ b/jstests/multiVersion/libs/multi_cluster.js
@@ -15,11 +15,14 @@
* upgradeMongos: <bool>, // defaults to true
* }
*/
-ShardingTest.prototype.upgradeCluster = function( binVersion, options ){
+ShardingTest.prototype.upgradeCluster = function(binVersion, options) {
options = options || {};
- if (options.upgradeShards == undefined) options.upgradeShards = true;
- if (options.upgradeConfigs == undefined) options.upgradeConfigs = true;
- if (options.upgradeMongos == undefined) options.upgradeMongos = true;
+ if (options.upgradeShards == undefined)
+ options.upgradeShards = true;
+ if (options.upgradeConfigs == undefined)
+ options.upgradeConfigs = true;
+ if (options.upgradeMongos == undefined)
+ options.upgradeMongos = true;
var upgradedSingleShards = [];
@@ -32,12 +35,10 @@ ShardingTest.prototype.upgradeCluster = function( binVersion, options ){
if (configSvr.host in upgradedSingleShards) {
configSvr = upgradedSingleShards[configSvr.host];
- }
- else {
+ } else {
MongoRunner.stopMongod(configSvr);
- configSvr = MongoRunner.runMongod({ restart: configSvr,
- binVersion: binVersion,
- appendOptions: true });
+ configSvr = MongoRunner.runMongod(
+ {restart: configSvr, binVersion: binVersion, appendOptions: true});
}
this["config" + i] = this["c" + i] = this._configServers[i] = configSvr;
@@ -49,18 +50,16 @@ ShardingTest.prototype.upgradeCluster = function( binVersion, options ){
// Upgrade shards
for (var i = 0; i < numShards; i++) {
- if( this._rs && this._rs[i] ){
+ if (this._rs && this._rs[i]) {
// Upgrade replica set
var rst = this._rs[i].test;
- rst.upgradeSet({ binVersion: binVersion });
- }
- else {
+ rst.upgradeSet({binVersion: binVersion});
+ } else {
// Upgrade shard
var shard = this._connections[i];
MongoRunner.stopMongod(shard);
- shard = MongoRunner.runMongod({ restart: shard,
- binVersion: binVersion,
- appendOptions: true });
+ shard = MongoRunner.runMongod(
+ {restart: shard, binVersion: binVersion, appendOptions: true});
upgradedSingleShards[shard.host] = shard;
this["shard" + i] = this["d" + i] = this._connections[i] = shard;
@@ -76,12 +75,12 @@ ShardingTest.prototype.upgradeCluster = function( binVersion, options ){
var mongos = this._mongos[i];
MongoRunner.stopMongos(mongos);
- mongos = MongoRunner.runMongos({ restart : mongos,
- binVersion : binVersion,
- appendOptions : true });
+ mongos = MongoRunner.runMongos(
+ {restart: mongos, binVersion: binVersion, appendOptions: true});
this["s" + i] = this._mongos[i] = mongos;
- if (i == 0) this.s = mongos;
+ if (i == 0)
+ this.s = mongos;
}
this.config = this.s.getDB("config");
@@ -90,22 +89,22 @@ ShardingTest.prototype.upgradeCluster = function( binVersion, options ){
};
ShardingTest.prototype.restartMongoses = function() {
-
+
var numMongoses = this._mongos.length;
-
+
for (var i = 0; i < numMongoses; i++) {
-
var mongos = this._mongos[i];
-
+
MongoRunner.stopMongos(mongos);
- mongos = MongoRunner.runMongos({ restart : mongos });
-
- this[ "s" + i ] = this._mongos[i] = mongos;
- if( i == 0 ) this.s = mongos;
+ mongos = MongoRunner.runMongos({restart: mongos});
+
+ this["s" + i] = this._mongos[i] = mongos;
+ if (i == 0)
+ this.s = mongos;
}
-
- this.config = this.s.getDB( "config" );
- this.admin = this.s.getDB( "admin" );
+
+ this.config = this.s.getDB("config");
+ this.admin = this.s.getDB("admin");
};
ShardingTest.prototype.getMongosAtVersion = function(binVersion) {
@@ -116,8 +115,7 @@ ShardingTest.prototype.getMongosAtVersion = function(binVersion) {
if (version.indexOf(binVersion) == 0) {
return mongoses[i];
}
- }
- catch (e) {
+ } catch (e) {
printjson(e);
print(mongoses[i]);
}