summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2021-01-20 20:42:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-05 05:20:16 +0000
commit709dca02b250194115e5a79fa6c6a4daa9b296a0 (patch)
treed7095dade8e6a8d73507855e56ae0a25470cccf7 /src/mongo/client
parent1736293848e2a251db316bb5b4f529739d5e5a27 (diff)
downloadmongo-709dca02b250194115e5a79fa6c6a4daa9b296a0.tar.gz
SERVER-52720: Handle choosing a new donor node when startApplyingOpTime exists
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.cpp6
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/client/streamable_replica_set_monitor.cpp b/src/mongo/client/streamable_replica_set_monitor.cpp
index 9d4764979be..3e118440cc6 100644
--- a/src/mongo/client/streamable_replica_set_monitor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor.cpp
@@ -356,18 +356,20 @@ SemiFuture<std::vector<HostAndPort>> StreamableReplicaSetMonitor::getHostsOrRefr
return {*immediateResult};
}
- return _enqueueOutstandingQuery(lk, criteria, cancelToken, deadline);
+ return _enqueueOutstandingQuery(lk, criteria, excludedHosts, cancelToken, deadline);
});
}
SemiFuture<std::vector<HostAndPort>> StreamableReplicaSetMonitor::_enqueueOutstandingQuery(
WithLock,
const ReadPreferenceSetting& criteria,
+ const std::vector<HostAndPort>& excludedHosts,
const CancelationToken& cancelToken,
const Date_t& deadline) {
auto query = std::make_shared<HostQuery>();
query->criteria = criteria;
+ query->excludedHosts = excludedHosts;
auto pf = makePromiseFuture<std::vector<HostAndPort>>();
query->promise = std::move(pf.promise);
@@ -783,7 +785,7 @@ void StreamableReplicaSetMonitor::_processOutstanding(
// If query has not been canceled yet, try to satisfy it.
if (!query->hasBeenResolved()) {
- auto result = _getHosts(topologyDescription, query->criteria);
+ auto result = _getHosts(topologyDescription, query->criteria, query->excludedHosts);
if (result) {
if (query->tryResolveWithSuccess(std::move(*result))) {
const auto latency = _executor->now() - query->start;
diff --git a/src/mongo/client/streamable_replica_set_monitor.h b/src/mongo/client/streamable_replica_set_monitor.h
index a1b0368981d..55cb63b87df 100644
--- a/src/mongo/client/streamable_replica_set_monitor.h
+++ b/src/mongo/client/streamable_replica_set_monitor.h
@@ -180,6 +180,8 @@ private:
ReadPreferenceSetting criteria;
+ std::vector<HostAndPort> excludedHosts;
+
// Used to compute latency.
Date_t start;
@@ -201,6 +203,7 @@ private:
SemiFuture<std::vector<HostAndPort>> _enqueueOutstandingQuery(
WithLock,
const ReadPreferenceSetting& criteria,
+ const std::vector<HostAndPort>& excludedHosts,
const CancelationToken& cancelToken,
const Date_t& deadline);