summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2021-04-19 22:23:46 +0000
committerAndrew Shuvalov <andrew.shuvalov@mongodb.com>2021-04-25 16:41:34 +0000
commitbb6d97a3dbf83611eb2ffdf7a6e7dcf8c37797ab (patch)
tree518c5076509570e8e3c257b856b0b938925654e6 /src
parent7a93b8e33051ea6e0b65f7431b736f71091509f8 (diff)
downloadmongo-bb6d97a3dbf83611eb2ffdf7a6e7dcf8c37797ab.tar.gz
SERVER-55456: better RSM logging
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/replica_set_monitor.cpp13
-rw-r--r--src/mongo/client/replica_set_monitor.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp
index c935ef00872..df192e48e11 100644
--- a/src/mongo/client/replica_set_monitor.cpp
+++ b/src/mongo/client/replica_set_monitor.cpp
@@ -595,7 +595,7 @@ void Refresher::receivedIsMaster(const HostAndPort& from,
// Handle various failure cases
if (!reply.ok) {
- failedHost(from, {ErrorCodes::CommandFailed, "Failed to execute 'ismaster' command"});
+ failedHost(from, {ErrorCodes::CommandFailed, "Failed to execute 'ismaster' command"}, verbose);
return;
}
@@ -618,14 +618,14 @@ void Refresher::receivedIsMaster(const HostAndPort& from,
{ErrorCodes::InconsistentReplicaSetNames,
str::stream() << "Target replica set name " << reply.setName
<< " does not match the monitored set name "
- << _set->name});
+ << _set->name}, verbose);
return;
}
if (reply.isMaster) {
Status status = receivedIsMasterFromMaster(from, reply, verbose);
if (!status.isOK()) {
- failedHost(from, status);
+ failedHost(from, status, verbose);
return;
}
}
@@ -648,7 +648,7 @@ void Refresher::receivedIsMaster(const HostAndPort& from,
DEV _set->checkInvariants();
}
-void Refresher::failedHost(const HostAndPort& host, const Status& status) {
+void Refresher::failedHost(const HostAndPort& host, const Status& status, bool verbose) {
_scan->waitingFor.erase(host);
// Failed hosts can't pass criteria, so the only way they'd effect the _refreshUntilMatches
@@ -861,6 +861,9 @@ HostAndPort Refresher::_refreshUntilMatches(const ReadPreferenceSetting* criteri
return criteria ? _set->getMatchingHost(*criteria) : HostAndPort();
case NextStep::WAIT: // TODO consider treating as DONE for refreshAll
+ if (verbose) {
+ log() << "RSM for " << _set->name << " starts waiting for condition change";
+ }
_set->cv.wait(lk);
continue;
@@ -903,7 +906,7 @@ HostAndPort Refresher::_refreshUntilMatches(const ReadPreferenceSetting* criteri
if (isMasterReplyStatus.isOK())
receivedIsMaster(ns.host, pingMicros, isMasterReplyStatus.getValue(), verbose);
else
- failedHost(ns.host, isMasterReplyStatus.getStatus());
+ failedHost(ns.host, isMasterReplyStatus.getStatus(), verbose);
}
}
diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h
index 4b5d811a673..abb072f0a2a 100644
--- a/src/mongo/client/replica_set_monitor.h
+++ b/src/mongo/client/replica_set_monitor.h
@@ -378,7 +378,7 @@ public:
/**
* Call this if a host returned from getNextStep failed to reply to an isMaster call.
*/
- void failedHost(const HostAndPort& host, const Status& status);
+ void failedHost(const HostAndPort& host, const Status& status, bool verbose);
/**
* Starts a new scan over the hosts in set.