diff options
author | Louis Williams <louis.williams@mongodb.com> | 2022-03-08 09:56:12 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-08 10:50:35 +0000 |
commit | 303a724f519e8d45d3b5d1d31c1ac509cfabf08c (patch) | |
tree | 46211bc3831eb61bcf9657bf8eec33c2fb21aa72 /src/mongo/db/catalog | |
parent | c66cf1511e10d79636e974e83918dec8acbc724c (diff) | |
download | mongo-303a724f519e8d45d3b5d1d31c1ac509cfabf08c.tar.gz |
SERVER-63531 Correct error to indicate that non-voting members can be included in commitQuorum
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/commit_quorum_options.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/catalog/commit_quorum_options_test.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/catalog/commit_quorum_options.cpp b/src/mongo/db/catalog/commit_quorum_options.cpp index dba101c94e8..c5f575f144f 100644 --- a/src/mongo/db/catalog/commit_quorum_options.cpp +++ b/src/mongo/db/catalog/commit_quorum_options.cpp @@ -68,12 +68,12 @@ Status CommitQuorumOptions::parse(const BSONElement& commitQuorumElement) { if (commitQuorumElement.isNumber()) { auto cNumNodes = commitQuorumElement.safeNumberLong(); if (cNumNodes < 0 || - cNumNodes > static_cast<decltype(cNumNodes)>(repl::ReplSetConfig::kMaxVotingMembers)) { + cNumNodes > static_cast<decltype(cNumNodes)>(repl::ReplSetConfig::kMaxMembers)) { return Status( ErrorCodes::FailedToParse, str::stream() << "commitQuorum has to be a non-negative number and not greater than " - << repl::ReplSetConfig::kMaxVotingMembers); + << repl::ReplSetConfig::kMaxMembers); } numNodes = static_cast<decltype(numNodes)>(cNumNodes); } else if (commitQuorumElement.type() == String) { diff --git a/src/mongo/db/catalog/commit_quorum_options_test.cpp b/src/mongo/db/catalog/commit_quorum_options_test.cpp index ad5c3a787bf..e0c6e4d6e4e 100644 --- a/src/mongo/db/catalog/commit_quorum_options_test.cpp +++ b/src/mongo/db/catalog/commit_quorum_options_test.cpp @@ -54,7 +54,7 @@ TEST(CommitQuorumOptionsTest, ParseReturnsFailedToParseIfCommitQuorumIsANegative BSONObj obj = BSON("commitQuorum" << -1); auto status = CommitQuorumOptions().parse(obj.getField("commitQuorum")); ASSERT_EQUALS(ErrorCodes::FailedToParse, status); - ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 7", + ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 50", status.reason()); } @@ -63,7 +63,7 @@ TEST(CommitQuorumOptionsTest, BSONObj obj = BSON("commitQuorum" << 70); auto status = CommitQuorumOptions().parse(obj.getField("commitQuorum")); ASSERT_EQUALS(ErrorCodes::FailedToParse, status); - ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 7", + ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 50", status.reason()); } |