diff options
Diffstat (limited to 'src/mongo/db/s/sharding_util.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_util.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mongo/db/s/sharding_util.cpp b/src/mongo/db/s/sharding_util.cpp index 26c8da56f8c..675f10cc521 100644 --- a/src/mongo/db/s/sharding_util.cpp +++ b/src/mongo/db/s/sharding_util.cpp @@ -36,7 +36,6 @@ #include "mongo/db/commands.h" #include "mongo/logv2/log.h" -#include "mongo/s/async_requests_sender.h" #include "mongo/s/request_types/flush_routing_table_cache_updates_gen.h" namespace mongo { @@ -55,16 +54,18 @@ void tellShardsToRefreshCollection(OperationContext* opCtx, sendCommandToShards(opCtx, NamespaceString::kAdminDb, cmdObj, shardIds, executor); } -void sendCommandToShards(OperationContext* opCtx, - StringData dbName, - const BSONObj& command, - const std::vector<ShardId>& shardIds, - const std::shared_ptr<executor::TaskExecutor>& executor) { +std::vector<AsyncRequestsSender::Response> sendCommandToShards( + OperationContext* opCtx, + StringData dbName, + const BSONObj& command, + const std::vector<ShardId>& shardIds, + const std::shared_ptr<executor::TaskExecutor>& executor) { std::vector<AsyncRequestsSender::Request> requests; for (const auto& shardId : shardIds) { requests.emplace_back(shardId, command); } + std::vector<AsyncRequestsSender::Response> responses; if (!requests.empty()) { // The _flushRoutingTableCacheUpdatesWithWriteConcern command will fail with a // QueryPlanKilled error response if the config.cache.chunks collection is dropped @@ -93,8 +94,11 @@ void sendCommandToShards(OperationContext* opCtx, auto wcStatus = getWriteConcernStatusFromCommandResult(shardResponse.data); uassertStatusOKWithContext(wcStatus, errorContext); + + responses.push_back(std::move(response)); } } + return responses; } } // namespace sharding_util |