diff options
author | Jason Carey <jcarey@argv.me> | 2019-06-06 13:49:44 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-06-06 18:47:33 -0400 |
commit | 8eed2fe5376ff6843ab1fe7881c8377812215185 (patch) | |
tree | 5de174bb359a11bc2fc23eda3fec93fb96031647 /src/mongo/s/async_requests_sender.h | |
parent | b63264646b4d81e27cfd6e16d61a90ba31dd3d95 (diff) | |
download | mongo-8eed2fe5376ff6843ab1fe7881c8377812215185.tar.gz |
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
Diffstat (limited to 'src/mongo/s/async_requests_sender.h')
-rw-r--r-- | src/mongo/s/async_requests_sender.h | 18 |
1 files changed, 11 insertions, 7 deletions
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<executor::RemoteCommandResponse> scheduleRequest(); + SemiFuture<RemoteCommandOnAnyCallbackArgs> 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<HostAndPort> resolveShardIdToHostAndPort(const ReadPreferenceSetting& readPref); + SemiFuture<std::vector<HostAndPort>> resolveShardIdToHostAndPorts( + const ReadPreferenceSetting& readPref); /** * Schedules the remote command on the ARS's TaskExecutor */ - SemiFuture<executor::RemoteCommandResponse> scheduleRemoteCommand( - HostAndPort&& hostAndPort); + SemiFuture<RemoteCommandOnAnyCallbackArgs> scheduleRemoteCommand( + std::vector<HostAndPort>&& hostAndPort); /** * Handles the remote response */ - SemiFuture<executor::RemoteCommandResponse> handleResponse( - executor::RemoteCommandResponse&& rcr); + SemiFuture<RemoteCommandOnAnyCallbackArgs> handleResponse( + RemoteCommandOnAnyCallbackArgs&& rcr); private: bool _done = false; |