summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-06-27 16:34:23 -0400
committerMathias Stearn <mathias@10gen.com>2017-07-13 16:53:13 -0400
commit10d31e1e3b4f32f842489e2a2de66a547e550b5a (patch)
tree9e61023e26af63704476d1e5782f54fa4d402f9a /src/mongo/client
parent704d2dc2a533e6297a6e77e23fb6afbf574e9572 (diff)
downloadmongo-10d31e1e3b4f32f842489e2a2de66a547e550b5a.tar.gz
SERVER-29731 upconvertRequest now uses document sequences where appropriate
In addition to improving test coverage for document sequences, this also improves performance of insert commands sent over OP_QUERY since they will no longer copy the objects during upconversion.
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/dbclient.cpp3
-rw-r--r--src/mongo/client/dbclientcursor.cpp9
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp
index 5ffffe9f4ce..23bc549c3ec 100644
--- a/src/mongo/client/dbclient.cpp
+++ b/src/mongo/client/dbclient.cpp
@@ -230,8 +230,7 @@ std::tuple<bool, DBClientWithCommands*> DBClientWithCommands::runCommandWithTarg
// TODO: This will be downconverted immediately if the underlying
// requestBuilder is a legacyRequest builder. Not sure what the best
// way to get around that is without breaking the abstraction.
- auto result = runCommandWithTarget(
- OpMsgRequest::fromDBAndBody(dbname, rpc::upconvertRequest(std::move(cmd), options)));
+ auto result = runCommandWithTarget(rpc::upconvertRequest(dbname, std::move(cmd), options));
info = result.first->getCommandReply().getOwned();
return std::make_tuple(isOk(info), result.second);
diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp
index c8847b4cd4d..5df6f4b3841 100644
--- a/src/mongo/client/dbclientcursor.cpp
+++ b/src/mongo/client/dbclientcursor.cpp
@@ -62,16 +62,17 @@ Message assembleCommandRequest(DBClientWithCommands* cli,
StringData database,
int legacyQueryOptions,
BSONObj legacyQuery) {
- BSONObjBuilder bodyBob(rpc::upconvertRequest(std::move(legacyQuery), legacyQueryOptions));
+ auto request = rpc::upconvertRequest(database, std::move(legacyQuery), legacyQueryOptions);
if (cli->getRequestMetadataWriter()) {
+ BSONObjBuilder bodyBob(std::move(request.body));
auto opCtx = (haveClient() ? cc().getOperationContext() : nullptr);
uassertStatusOK(cli->getRequestMetadataWriter()(opCtx, &bodyBob));
+ request.body = bodyBob.obj();
}
- return rpc::messageFromOpMsgRequest(cli->getClientRPCProtocols(),
- cli->getServerRPCProtocols(),
- OpMsgRequest::fromDBAndBody(database, bodyBob.obj()));
+ return rpc::messageFromOpMsgRequest(
+ cli->getClientRPCProtocols(), cli->getServerRPCProtocols(), std::move(request));
}
} // namespace