From 8eed2fe5376ff6843ab1fe7881c8377812215185 Mon Sep 17 00:00:00 2001 From: Jason Carey Date: Thu, 6 Jun 2019 13:49:44 -0400 Subject: SERVER-41132 Opportunistic targeting for ARS Inside the ARS, support use of the TaskExecutor::scheduleRemoteCommandOnAny method, which will allow the ARS to use any acceptable host returned from targeting, rather than requiring us to use one at random. This should allow us to prefer routing requests to hosts which have ready connections to, or that we can generate ready connections to faster --- src/mongo/s/async_requests_sender.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/mongo/s/async_requests_sender.h') diff --git a/src/mongo/s/async_requests_sender.h b/src/mongo/s/async_requests_sender.h index 86387d01bbe..95c457e2e7f 100644 --- a/src/mongo/s/async_requests_sender.h +++ b/src/mongo/s/async_requests_sender.h @@ -168,6 +168,9 @@ private: */ class RemoteData { public: + using RemoteCommandOnAnyCallbackArgs = + executor::TaskExecutor::RemoteCommandOnAnyCallbackArgs; + /** * Creates a new uninitialized remote state with a command to send. */ @@ -210,24 +213,25 @@ private: * * for the given shard. */ - SemiFuture scheduleRequest(); + SemiFuture scheduleRequest(); /** - * Given a read preference, selects a host on which the command should be run. + * Given a read preference, selects a lists of hosts on which the command can run. */ - SemiFuture resolveShardIdToHostAndPort(const ReadPreferenceSetting& readPref); + SemiFuture> resolveShardIdToHostAndPorts( + const ReadPreferenceSetting& readPref); /** * Schedules the remote command on the ARS's TaskExecutor */ - SemiFuture scheduleRemoteCommand( - HostAndPort&& hostAndPort); + SemiFuture scheduleRemoteCommand( + std::vector&& hostAndPort); /** * Handles the remote response */ - SemiFuture handleResponse( - executor::RemoteCommandResponse&& rcr); + SemiFuture handleResponse( + RemoteCommandOnAnyCallbackArgs&& rcr); private: bool _done = false; -- cgit v1.2.1