diff options
author | Jordi Olivares Provencio <jordi.olivares-provencio@mongodb.com> | 2022-01-12 09:38:01 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-12 10:14:28 +0000 |
commit | 0796354eecd6565aeaf494c1f580f3440ba2bd7a (patch) | |
tree | f8c8a017494696216aa1f255197d94cd92ad6092 /src/mongo/db/catalog | |
parent | bbcbf943b3506c6825b67421cc358da4bb4840c4 (diff) | |
download | mongo-0796354eecd6565aeaf494c1f580f3440ba2bd7a.tar.gz |
SERVER-56146 Fix commitQuorum error message
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 a20218fa6e6..0a85a812b56 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::kMaxMembers)) { + cNumNodes > static_cast<decltype(cNumNodes)>(repl::ReplSetConfig::kMaxVotingMembers)) { return Status( ErrorCodes::FailedToParse, str::stream() << "commitQuorum has to be a non-negative number and not greater than " - << repl::ReplSetConfig::kMaxMembers); + << repl::ReplSetConfig::kMaxVotingMembers); } 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 e0c6e4d6e4e..ad5c3a787bf 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 50", + ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 7", 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 50", + ASSERT_EQUALS("commitQuorum has to be a non-negative number and not greater than 7", status.reason()); } |