summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/slow1/large_set.js59
-rw-r--r--src/mongo/db/repl/replica_set_config.h2
-rw-r--r--src/mongo/db/repl/replica_set_config_test.cpp127
3 files changed, 187 insertions, 1 deletions
diff --git a/jstests/slow1/large_set.js b/jstests/slow1/large_set.js
new file mode 100644
index 00000000000..afe14788fce
--- /dev/null
+++ b/jstests/slow1/large_set.js
@@ -0,0 +1,59 @@
+(function() {
+ "use strict";
+ var name = "large_set";
+ var replTest = new ReplSetTest({name: name,
+ nodes: 30,
+ oplogSize: 5,
+ nodeOptions: {smallfiles:""} });
+ var host = getHostName();
+
+ var nodes = replTest.startSet();
+ replTest.initiate({_id : name, members : [
+ {_id : 0, host : host+":"+replTest.ports[0]},
+ {_id : 1, host : host+":"+replTest.ports[1]},
+ {_id : 2, host : host+":"+replTest.ports[2]},
+ {_id : 3, host : host+":"+replTest.ports[3]},
+ {_id : 4, host : host+":"+replTest.ports[4]},
+ {_id : 5, host : host+":"+replTest.ports[5], "arbiterOnly": true},
+ {_id : 6, host : host+":"+replTest.ports[6], "arbiterOnly": true},
+ {_id : 7, host : host+":"+replTest.ports[7], "votes": 0},
+ {_id : 8, host : host+":"+replTest.ports[8], "votes": 0},
+ {_id : 9, host : host+":"+replTest.ports[9], "votes": 0},
+ {_id : 10, host : host+":"+replTest.ports[10], "votes": 0},
+ {_id : 11, host : host+":"+replTest.ports[11], "votes": 0},
+ {_id : 12, host : host+":"+replTest.ports[12], "votes": 0},
+ {_id : 13, host : host+":"+replTest.ports[13], "votes": 0},
+ {_id : 14, host : host+":"+replTest.ports[14], "votes": 0},
+ {_id : 15, host : host+":"+replTest.ports[15], "votes": 0},
+ {_id : 16, host : host+":"+replTest.ports[16], "votes": 0},
+ {_id : 17, host : host+":"+replTest.ports[17], "votes": 0},
+ {_id : 18, host : host+":"+replTest.ports[18], "votes": 0},
+ {_id : 19, host : host+":"+replTest.ports[19], "votes": 0},
+ {_id : 20, host : host+":"+replTest.ports[20], "votes": 0},
+ {_id : 21, host : host+":"+replTest.ports[21], "votes": 0},
+ {_id : 22, host : host+":"+replTest.ports[22], "votes": 0},
+ {_id : 23, host : host+":"+replTest.ports[23], "votes": 0},
+ {_id : 24, host : host+":"+replTest.ports[24], "votes": 0},
+ {_id : 25, host : host+":"+replTest.ports[25], "votes": 0},
+ {_id : 26, host : host+":"+replTest.ports[26], "votes": 0},
+ {_id : 27, host : host+":"+replTest.ports[27], "votes": 0},
+ {_id : 28, host : host+":"+replTest.ports[28], "votes": 0},
+ {_id : 29, host : host+":"+replTest.ports[29], "votes": 0}
+ ]});
+
+ replTest.awaitSecondaryNodes();
+ replTest.awaitReplication();
+
+ var master = replTest.getMaster();
+ assert.writeOK(master.getDB("test").foo.save({ a: "test" },
+ { writeConcern: { w: 'majority' }}));
+
+ replTest.stop(2);
+ replTest.stop(3);
+ replTest.stop(4);
+ jsTest.log("3 voting nodes taken down; attempting impossible, majority writeConcern write");
+ assert.writeError(master.getDB("test").foo.save({ a: "test" },
+ { writeConcern: { w: 'majority',
+ wtimeout: 10*1000 }}));
+ replTest.stopSet();
+}());
diff --git a/src/mongo/db/repl/replica_set_config.h b/src/mongo/db/repl/replica_set_config.h
index a66aa1fd941..266b2f9dc14 100644
--- a/src/mongo/db/repl/replica_set_config.h
+++ b/src/mongo/db/repl/replica_set_config.h
@@ -59,7 +59,7 @@ namespace repl {
static const std::string kMajorityWriteConcernModeName;
static const std::string kStepDownCheckWriteConcernModeName;
- static const size_t kMaxMembers = 12;
+ static const size_t kMaxMembers = 50;
static const size_t kMaxVotingMembers = 7;
static const Seconds kDefaultHeartbeatTimeoutPeriod;
diff --git a/src/mongo/db/repl/replica_set_config_test.cpp b/src/mongo/db/repl/replica_set_config_test.cpp
index 3fb71c573f4..c81ff851dc0 100644
--- a/src/mongo/db/repl/replica_set_config_test.cpp
+++ b/src/mongo/db/repl/replica_set_config_test.cpp
@@ -768,6 +768,133 @@ namespace {
configA.checkIfWriteConcernCanBeSatisfied(invalidModeNotEnoughNodesWC));
}
+ TEST(ReplicaSetConfig, CheckMaximumNodesOkay) {
+ ReplicaSetConfig configA;
+ ReplicaSetConfig configB;
+ ASSERT_OK(configA.initialize(
+ BSON("_id" << "rs0" <<
+ "version" << 1 <<
+ "members" << BSON_ARRAY(
+ BSON("_id" << 0 << "host" << "node0") <<
+ BSON("_id" << 1 << "host" << "node1") <<
+ BSON("_id" << 2 << "host" << "node2") <<
+ BSON("_id" << 3 << "host" << "node3") <<
+ BSON("_id" << 4 << "host" << "node4") <<
+ BSON("_id" << 5 << "host" << "node5") <<
+ BSON("_id" << 6 << "host" << "node6") <<
+ BSON("_id" << 7 << "host" << "node7" << "votes" << 0) <<
+ BSON("_id" << 8 << "host" << "node8" << "votes" << 0) <<
+ BSON("_id" << 9 << "host" << "node9" << "votes" << 0) <<
+ BSON("_id" << 10 << "host" << "node10" << "votes" << 0) <<
+ BSON("_id" << 11 << "host" << "node11" << "votes" << 0) <<
+ BSON("_id" << 12 << "host" << "node12" << "votes" << 0) <<
+ BSON("_id" << 13 << "host" << "node13" << "votes" << 0) <<
+ BSON("_id" << 14 << "host" << "node14" << "votes" << 0) <<
+ BSON("_id" << 15 << "host" << "node15" << "votes" << 0) <<
+ BSON("_id" << 16 << "host" << "node16" << "votes" << 0) <<
+ BSON("_id" << 17 << "host" << "node17" << "votes" << 0) <<
+ BSON("_id" << 18 << "host" << "node18" << "votes" << 0) <<
+ BSON("_id" << 19 << "host" << "node19" << "votes" << 0) <<
+ BSON("_id" << 20 << "host" << "node20" << "votes" << 0) <<
+ BSON("_id" << 21 << "host" << "node21" << "votes" << 0) <<
+ BSON("_id" << 22 << "host" << "node22" << "votes" << 0) <<
+ BSON("_id" << 23 << "host" << "node23" << "votes" << 0) <<
+ BSON("_id" << 24 << "host" << "node24" << "votes" << 0) <<
+ BSON("_id" << 25 << "host" << "node25" << "votes" << 0) <<
+ BSON("_id" << 26 << "host" << "node26" << "votes" << 0) <<
+ BSON("_id" << 27 << "host" << "node27" << "votes" << 0) <<
+ BSON("_id" << 28 << "host" << "node28" << "votes" << 0) <<
+ BSON("_id" << 29 << "host" << "node29" << "votes" << 0) <<
+ BSON("_id" << 30 << "host" << "node30" << "votes" << 0) <<
+ BSON("_id" << 31 << "host" << "node31" << "votes" << 0) <<
+ BSON("_id" << 32 << "host" << "node32" << "votes" << 0) <<
+ BSON("_id" << 33 << "host" << "node33" << "votes" << 0) <<
+ BSON("_id" << 34 << "host" << "node34" << "votes" << 0) <<
+ BSON("_id" << 35 << "host" << "node35" << "votes" << 0) <<
+ BSON("_id" << 36 << "host" << "node36" << "votes" << 0) <<
+ BSON("_id" << 37 << "host" << "node37" << "votes" << 0) <<
+ BSON("_id" << 38 << "host" << "node38" << "votes" << 0) <<
+ BSON("_id" << 39 << "host" << "node39" << "votes" << 0) <<
+ BSON("_id" << 40 << "host" << "node40" << "votes" << 0) <<
+ BSON("_id" << 41 << "host" << "node41" << "votes" << 0) <<
+ BSON("_id" << 42 << "host" << "node42" << "votes" << 0) <<
+ BSON("_id" << 43 << "host" << "node43" << "votes" << 0) <<
+ BSON("_id" << 44 << "host" << "node44" << "votes" << 0) <<
+ BSON("_id" << 45 << "host" << "node45" << "votes" << 0) <<
+ BSON("_id" << 46 << "host" << "node46" << "votes" << 0) <<
+ BSON("_id" << 47 << "host" << "node47" << "votes" << 0) <<
+ BSON("_id" << 48 << "host" << "node48" << "votes" << 0) <<
+ BSON("_id" << 49 << "host" << "node49" << "votes" << 0)))));
+ ASSERT_OK(configB.initialize(configA.toBSON()));
+ ASSERT_OK(configA.validate());
+ ASSERT_OK(configB.validate());
+ ASSERT_TRUE(configA == configB);
+ }
+
+ TEST(ReplicaSetConfig, CheckBeyondMaximumNodesFailsValidate) {
+ ReplicaSetConfig configA;
+ ReplicaSetConfig configB;
+ ASSERT_OK(configA.initialize(
+ BSON("_id" << "rs0" <<
+ "version" << 1 <<
+ "members" << BSON_ARRAY(
+ BSON("_id" << 0 << "host" << "node0") <<
+ BSON("_id" << 1 << "host" << "node1") <<
+ BSON("_id" << 2 << "host" << "node2") <<
+ BSON("_id" << 3 << "host" << "node3") <<
+ BSON("_id" << 4 << "host" << "node4") <<
+ BSON("_id" << 5 << "host" << "node5") <<
+ BSON("_id" << 6 << "host" << "node6") <<
+ BSON("_id" << 7 << "host" << "node7" << "votes" << 0) <<
+ BSON("_id" << 8 << "host" << "node8" << "votes" << 0) <<
+ BSON("_id" << 9 << "host" << "node9" << "votes" << 0) <<
+ BSON("_id" << 10 << "host" << "node10" << "votes" << 0) <<
+ BSON("_id" << 11 << "host" << "node11" << "votes" << 0) <<
+ BSON("_id" << 12 << "host" << "node12" << "votes" << 0) <<
+ BSON("_id" << 13 << "host" << "node13" << "votes" << 0) <<
+ BSON("_id" << 14 << "host" << "node14" << "votes" << 0) <<
+ BSON("_id" << 15 << "host" << "node15" << "votes" << 0) <<
+ BSON("_id" << 16 << "host" << "node16" << "votes" << 0) <<
+ BSON("_id" << 17 << "host" << "node17" << "votes" << 0) <<
+ BSON("_id" << 18 << "host" << "node18" << "votes" << 0) <<
+ BSON("_id" << 19 << "host" << "node19" << "votes" << 0) <<
+ BSON("_id" << 20 << "host" << "node20" << "votes" << 0) <<
+ BSON("_id" << 21 << "host" << "node21" << "votes" << 0) <<
+ BSON("_id" << 22 << "host" << "node22" << "votes" << 0) <<
+ BSON("_id" << 23 << "host" << "node23" << "votes" << 0) <<
+ BSON("_id" << 24 << "host" << "node24" << "votes" << 0) <<
+ BSON("_id" << 25 << "host" << "node25" << "votes" << 0) <<
+ BSON("_id" << 26 << "host" << "node26" << "votes" << 0) <<
+ BSON("_id" << 27 << "host" << "node27" << "votes" << 0) <<
+ BSON("_id" << 28 << "host" << "node28" << "votes" << 0) <<
+ BSON("_id" << 29 << "host" << "node29" << "votes" << 0) <<
+ BSON("_id" << 30 << "host" << "node30" << "votes" << 0) <<
+ BSON("_id" << 31 << "host" << "node31" << "votes" << 0) <<
+ BSON("_id" << 32 << "host" << "node32" << "votes" << 0) <<
+ BSON("_id" << 33 << "host" << "node33" << "votes" << 0) <<
+ BSON("_id" << 34 << "host" << "node34" << "votes" << 0) <<
+ BSON("_id" << 35 << "host" << "node35" << "votes" << 0) <<
+ BSON("_id" << 36 << "host" << "node36" << "votes" << 0) <<
+ BSON("_id" << 37 << "host" << "node37" << "votes" << 0) <<
+ BSON("_id" << 38 << "host" << "node38" << "votes" << 0) <<
+ BSON("_id" << 39 << "host" << "node39" << "votes" << 0) <<
+ BSON("_id" << 40 << "host" << "node40" << "votes" << 0) <<
+ BSON("_id" << 41 << "host" << "node41" << "votes" << 0) <<
+ BSON("_id" << 42 << "host" << "node42" << "votes" << 0) <<
+ BSON("_id" << 43 << "host" << "node43" << "votes" << 0) <<
+ BSON("_id" << 44 << "host" << "node44" << "votes" << 0) <<
+ BSON("_id" << 45 << "host" << "node45" << "votes" << 0) <<
+ BSON("_id" << 46 << "host" << "node46" << "votes" << 0) <<
+ BSON("_id" << 47 << "host" << "node47" << "votes" << 0) <<
+ BSON("_id" << 48 << "host" << "node48" << "votes" << 0) <<
+ BSON("_id" << 49 << "host" << "node49" << "votes" << 0) <<
+ BSON("_id" << 50 << "host" << "node50" << "votes" << 0)))));
+ ASSERT_OK(configB.initialize(configA.toBSON()));
+ ASSERT_NOT_OK(configA.validate());
+ ASSERT_NOT_OK(configB.validate());
+ ASSERT_TRUE(configA == configB);
+ }
+
} // namespace
} // namespace repl
} // namespace mongo