summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2021-10-13 14:57:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-13 15:56:24 +0000
commit5462b81c4a678b63c340bfa51640da3fecad0358 (patch)
tree2a765fd47e01e6e9817dbaea1ccd5b5a9d25a229 /src/mongo/client
parent9172b9b45c148eed11714912b140f89cf763d9e2 (diff)
downloadmongo-5462b81c4a678b63c340bfa51640da3fecad0358.tar.gz
SERVER-59300 Make AsyncDBClient use OP_MSG rather than OP_QUERY for isMaster
Removing any lingering uses of OP_QUERY will be helpful in order to eventually remove the final traces of OP_QUERY support from the code base. Changing the AsyncDBClient to use the "hello" command rather than "isMaster" is left as a future improvement.
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/async_client.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mongo/client/async_client.cpp b/src/mongo/client/async_client.cpp
index 1af9070645b..309475ec36e 100644
--- a/src/mongo/client/async_client.cpp
+++ b/src/mongo/client/async_client.cpp
@@ -107,8 +107,8 @@ BSONObj AsyncDBClient::_buildIsMasterRequest(const std::string& appName,
void AsyncDBClient::_parseIsMasterResponse(BSONObj request,
const std::unique_ptr<rpc::ReplyInterface>& response) {
uassert(50786,
- "Expected opQuery response to isMaster",
- response->getProtocol() == rpc::Protocol::kOpQuery);
+ "Expected OP_MSG response to isMaster",
+ response->getProtocol() == rpc::Protocol::kOpMsg);
auto wireSpec = WireSpec::instance().get();
auto responseBody = response->getCommandReply();
uassertStatusOK(getStatusFromCommandResult(responseBody));
@@ -233,16 +233,10 @@ Future<bool> AsyncDBClient::completeSpeculativeAuth(std::shared_ptr<SaslClientSe
Future<void> AsyncDBClient::initWireVersion(const std::string& appName,
executor::NetworkConnectionHook* const hook) {
auto requestObj = _buildIsMasterRequest(appName, hook);
- // We use a legacy request to create our ismaster request because we may
- // have to communicate with servers that do not support other protocols.
- auto requestMsg = makeDeprecatedQueryMessage("admin.$cmd",
- requestObj,
- 1 /*nToReturn*/,
- 0 /*nToSkip*/,
- nullptr /*fieldsToReturn*/,
- 0 /*queryOptions*/);
+ auto opMsgRequest = OpMsgRequest::fromDBAndBody("admin", requestObj);
+
auto msgId = nextMessageId();
- return _call(requestMsg, msgId)
+ return _call(opMsgRequest.serialize(), msgId)
.then([msgId, this]() { return _waitForResponse(msgId); })
.then([this, requestObj, hook, timer = Timer{}](Message response) {
auto cmdReply = rpc::makeReply(&response);