summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2014-12-03 13:54:39 -0500
committerSpencer T Brody <spencer@mongodb.com>2014-12-03 18:12:00 -0500
commit4b3cae88318ada78ccb6e195e8aa85b61069cbb8 (patch)
tree8cac13d7f5035e5e1f83ed4568f6d8417361794a
parent7f7c8fa39db6ca075ba51497aa3e4ddd1254ace4 (diff)
downloadmongo-4b3cae88318ada78ccb6e195e8aa85b61069cbb8.tar.gz
SERVER-16375 Prevent truncating of log message about remote node vetoing us
-rw-r--r--src/mongo/db/repl/freshness_checker.cpp4
-rw-r--r--src/mongo/db/repl/freshness_checker_test.cpp12
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) {