summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shardingtest.js
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2015-07-29 18:02:37 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2015-09-23 14:50:56 -0400
commit2c1facf471cce8254e314755c3c7d2fbc753e5f4 (patch)
tree8e3f51519dd151cda6799dd52e6d0640c4a0ec05 /src/mongo/shell/shardingtest.js
parent75115dfaab9da2854b0fd892ce029781afea2731 (diff)
downloadmongo-2c1facf471cce8254e314755c3c7d2fbc753e5f4.tar.gz
SERVER-18498 New replica set configurations have protocolVersion=1 by default
Diffstat (limited to 'src/mongo/shell/shardingtest.js')
-rw-r--r--src/mongo/shell/shardingtest.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index 99ed173c615..e794e02c874 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -19,6 +19,8 @@
* contain:
* {
* nodes {number}: number of replica members. Defaults to 3.
+ * protocolVersion {number}: protocol version of replset used by the
+ * replset initiation.
* For other options, @see ReplSetTest#start
* }
*
@@ -64,10 +66,10 @@
* specify options that are common all replica members.
* useHostname {boolean}: if true, use hostname of machine,
* otherwise use localhost
- * numReplicas {number}
+ * numReplicas {number}
* }
* }
- *
+ *
* Member variables:
* s {Mongo} - connection to the first mongos
* s0, s1, ... {Mongo} - connection to different mongos
@@ -193,8 +195,10 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other
rsDefaults = Object.merge( rsDefaults, otherParams["rs" + i] )
rsDefaults.nodes = rsDefaults.nodes || otherParams.numReplicas
- var numReplicas = rsDefaults.nodes || 3
- delete rsDefaults.nodes
+ var numReplicas = rsDefaults.nodes || 3;
+ delete rsDefaults.nodes;
+ var protocolVersion = rsDefaults.protocolVersion;
+ delete rsDefaults.protocolVersion;
print( "Replica set test!" )
@@ -209,7 +213,11 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other
nodes : rs.startSet(rsDefaults),
url : rs.getURL() };
- rs.initiate();
+ var config = rs.getReplSetConfig();
+ if (protocolVersion !== undefined && protocolVersion !== null) {
+ config.protocolVersion = protocolVersion;
+ }
+ rs.initiate(config);
this["rs" + i] = rs
this._rsObjects[i] = rs