From 4b3cae88318ada78ccb6e195e8aa85b61069cbb8 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Wed, 3 Dec 2014 13:54:39 -0500 Subject: SERVER-16375 Prevent truncating of log message about remote node vetoing us --- src/mongo/db/repl/freshness_checker.cpp | 4 ++-- src/mongo/db/repl/freshness_checker_test.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mongo/db/repl/freshness_checker.cpp b/src/mongo/db/repl/freshness_checker.cpp index 2d55e7c2bbb..07abbe806de 100644 --- a/src/mongo/db/repl/freshness_checker.cpp +++ b/src/mongo/db/repl/freshness_checker.cpp @@ -182,9 +182,9 @@ namespace repl { if (res["veto"].trueValue()) { BSONElement msg = res["errmsg"]; - if (!msg.eoo()) { + if (msg.type() == String) { log() << "not electing self, " << request.target.toString() << - " would veto with '" << msg << "'"; + " would veto with '" << msg.String() << "'"; } else { log() << "not electing self, " << request.target.toString() << diff --git a/src/mongo/db/repl/freshness_checker_test.cpp b/src/mongo/db/repl/freshness_checker_test.cpp index 3dfb993f3a3..f17e860b67d 100644 --- a/src/mongo/db/repl/freshness_checker_test.cpp +++ b/src/mongo/db/repl/freshness_checker_test.cpp @@ -411,8 +411,8 @@ namespace { stopCapturingLogMessages(); ASSERT_EQUALS(shouldAbortElection(), FreshnessChecker::FresherNodeFound); - ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h1:27017 would veto with '" - "errmsg: \"I'd rather you didn't\"'")); + ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h1:27017 would veto with " + "'I'd rather you didn't'")); } int findIdForMember(const ReplicaSetConfig& rsConfig, const HostAndPort& host) { @@ -677,8 +677,8 @@ namespace { waitOnChecker(); stopCapturingLogMessages(); ASSERT_EQUALS(shouldAbortElection(), FreshnessChecker::FresherNodeFound); - ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h1:27017 would veto with '" - "errmsg: \"I'd rather you didn't\"'")); + ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h1:27017 would veto with " + "'I'd rather you didn't'")); } TEST_F(FreshnessCheckerTest, ElectVetoedAndTiedFreshnessManyNodes) { @@ -761,8 +761,8 @@ namespace { waitOnChecker(); stopCapturingLogMessages(); ASSERT_EQUALS(shouldAbortElection(), FreshnessChecker::FresherNodeFound); - ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h4:27017 would veto with '" - "errmsg: \"I'd rather you didn't\"'")); + ASSERT_EQUALS(1, countLogLinesContaining("not electing self, h4:27017 would veto with " + "'I'd rather you didn't'")); } TEST_F(FreshnessCheckerTest, ElectManyNodesNotAllRespond) { -- cgit v1.2.1