void ReplSetConfig::MemberCfg::check() const { mchk(_id >= 0 && _id <= 255); mchk(priority >= 0 && priority <= 1000); mchk(votes <= 100); // votes >= 0 because it is unsigned uassert(13419, "this version of mongod only supports priorities 0 and 1", priority == 0 || priority == 1); uassert(13437, "slaveDelay requires priority be zero", slaveDelay == 0 || priority == 0); uassert(13438, "bad slaveDelay value", slaveDelay >= 0 && slaveDelay <= 3600 * 24 * 366); uassert(13439, "priority must be 0 when hidden=true", priority == 0 || !hidden); uassert(13477, "priority must be 0 when buildIndexes=false", buildIndexes || priority == 0); }
void ReplSetConfig::MemberCfg::check() const { mchk(_id >= 0 && _id <= 255); mchk(priority >= 0 && priority <= 1000); mchk(votes >= 0 && votes <= 100); uassert(13419, "this version of mongod only supports priorities 0 and 1", priority == 0 || priority == 1); uassert(13437, "slaveDelay requires priority be zero", slaveDelay == 0 || priority == 0); uassert(13438, "bad slaveDelay value", slaveDelay >= 0 && slaveDelay <= 3600 * 24 * 366); uassert(13439, "priority must be 0 when hidden=true", priority == 0 || !hidden); uassert(13477, "priority must be 0 when buildIndexes=false", buildIndexes || priority == 0); if (!initialSync.isEmpty()) { static const string legal[] = {"state", "name", "_id","optime"}; static const set<string> legals(legal, legal + 4); assertOnlyHas(initialSync, legals); if (initialSync.hasElement("state")) { uassert(13525, "initialSync source state must be 1 or 2", initialSync["state"].isNumber() && (initialSync["state"].Number() == 1 || initialSync["state"].Number() == 2)); } if (initialSync.hasElement("name")) { uassert(13526, "initialSync source name must be a string", initialSync["name"].type() == mongo::String); } if (initialSync.hasElement("_id")) { uassert(13527, "initialSync source _id must be a number", initialSync["_id"].isNumber()); } if (initialSync.hasElement("optime")) { uassert(13528, "initialSync source optime must be a timestamp", initialSync["optime"].type() == mongo::Timestamp || initialSync["optime"].type() == mongo::Date); } } }