diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-04-06 14:39:35 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-04-06 18:14:13 -0400 |
commit | 1e28d93c599dcc963eb53986c2e8fb2bc4f8935c (patch) | |
tree | 6da5e1c962c0cb0091c132be08a689f25fb4ff75 /src/mongo/s/commands/cluster_db_stats_cmd.cpp | |
parent | b307c9eb7699b09c2cae2aa7235300c05abab5ed (diff) | |
download | mongo-1e28d93c599dcc963eb53986c2e8fb2bc4f8935c.tar.gz |
SERVER-28656 consolidate utility functions for forwarding commands to shards into cluster_commands_common.h
Diffstat (limited to 'src/mongo/s/commands/cluster_db_stats_cmd.cpp')
-rw-r--r-- | src/mongo/s/commands/cluster_db_stats_cmd.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/mongo/s/commands/cluster_db_stats_cmd.cpp b/src/mongo/s/commands/cluster_db_stats_cmd.cpp index 16151cf0f1c..ea83968a486 100644 --- a/src/mongo/s/commands/cluster_db_stats_cmd.cpp +++ b/src/mongo/s/commands/cluster_db_stats_cmd.cpp @@ -30,9 +30,9 @@ #include <vector> -#include "mongo/s/commands/scatter_gather_from_shards.h" - +#include "mongo/db/commands.h" #include "mongo/s/client/shard_registry.h" +#include "mongo/s/commands/cluster_commands_common.h" #include "mongo/s/grid.h" namespace mongo { @@ -71,20 +71,11 @@ public: int options, std::string& errmsg, BSONObjBuilder& output) override { - - // Target all shards. - std::vector<AsyncRequestsSender::Request> requests; - std::vector<ShardId> shardIds; - Grid::get(opCtx)->shardRegistry()->getAllShardIds(&shardIds); - for (auto&& shardId : shardIds) { - requests.emplace_back(std::move(shardId), cmdObj); - } - + auto requests = buildRequestsForAllShards(opCtx, cmdObj); auto swResults = gatherResults(opCtx, dbName, cmdObj, options, requests, &output); if (!swResults.isOK()) { return appendCommandStatus(output, swResults.getStatus()); } - aggregateResults(std::move(swResults.getValue()), output); return true; } |