summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_write_cmd.cpp
diff options
context:
space:
mode:
authorChou Mao <chou.mao@10gen.com>2019-09-16 19:05:32 +0000
committerevergreen <evergreen@mongodb.com>2019-09-16 19:05:32 +0000
commiteddda0424bd26a9784c373d510a61a49b38790e8 (patch)
tree5e0bae935ceeb0cbc8d55f6d8bd8a02ccce74637 /src/mongo/s/commands/cluster_write_cmd.cpp
parent2906eb342a59295dbcf9aabc8692efe963dda6bd (diff)
downloadmongo-eddda0424bd26a9784c373d510a61a49b38790e8.tar.gz
SERVER-43299 Make explain for write commands send databaseVersion
Diffstat (limited to 'src/mongo/s/commands/cluster_write_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_write_cmd.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp
index c3d8081a816..6fd2853dcba 100644
--- a/src/mongo/s/commands/cluster_write_cmd.cpp
+++ b/src/mongo/s/commands/cluster_write_cmd.cpp
@@ -366,7 +366,13 @@ private:
// Assemble requests
std::vector<AsyncRequestsSender::Request> requests;
for (const auto& endpoint : swEndpoints.getValue()) {
- requests.emplace_back(endpoint.shardName, command);
+ BSONObj cmdObjWithVersions = BSONObj(command);
+ if (endpoint.databaseVersion) {
+ cmdObjWithVersions =
+ appendDbVersionIfPresent(cmdObjWithVersions, *endpoint.databaseVersion);
+ }
+ cmdObjWithVersions = appendShardVersion(cmdObjWithVersions, endpoint.shardVersion);
+ requests.emplace_back(endpoint.shardName, cmdObjWithVersions);
}
// Send the requests.