diff options
Diffstat (limited to 'src/mongo/s/cluster_commands_helpers.cpp')
-rw-r--r-- | src/mongo/s/cluster_commands_helpers.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/s/cluster_commands_helpers.cpp b/src/mongo/s/cluster_commands_helpers.cpp index f5f5c0fb812..fea6ded53a5 100644 --- a/src/mongo/s/cluster_commands_helpers.cpp +++ b/src/mongo/s/cluster_commands_helpers.cpp @@ -563,6 +563,26 @@ std::set<ShardId> getTargetedShardsForQuery(OperationContext* opCtx, return {routingInfo.db().primaryId()}; } +std::vector<std::pair<ShardId, BSONObj>> getVersionedRequestsForTargetedShards( + OperationContext* opCtx, + const NamespaceString& nss, + const CachedCollectionRoutingInfo& routingInfo, + const BSONObj& cmdObj, + const BSONObj& query, + const BSONObj& collation) { + std::vector<std::pair<ShardId, BSONObj>> requests; + auto ars_requests = + buildVersionedRequestsForTargetedShards(opCtx, nss, routingInfo, cmdObj, query, collation); + std::transform(std::make_move_iterator(ars_requests.begin()), + std::make_move_iterator(ars_requests.end()), + std::back_inserter(requests), + [](auto&& ars) { + return std::pair<ShardId, BSONObj>(std::move(ars.shardId), + std::move(ars.cmdObj)); + }); + return requests; +} + StatusWith<CachedCollectionRoutingInfo> getCollectionRoutingInfoForTxnCmd( OperationContext* opCtx, const NamespaceString& nss) { auto catalogCache = Grid::get(opCtx)->catalogCache(); |