summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@10gen.com>2020-06-08 12:33:42 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-10 02:22:04 +0000
commited16dca5ef0d474f487af5ca40729fec8dab7102 (patch)
treeb99d28096d0e2927b4eb5bfe6b169462fdcb0044 /src/mongo/db/pipeline
parentad170b9f34c828ec25404f600e95416639e1fecd (diff)
downloadmongo-ed16dca5ef0d474f487af5ca40729fec8dab7102.tar.gz
SERVER-46738 Ensure let parameters work for sharded find
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/sharded_agg_helpers.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.cpp b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
index 72c023032f9..7e02ec30fe3 100644
--- a/src/mongo/db/pipeline/sharded_agg_helpers.cpp
+++ b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
@@ -216,7 +216,7 @@ std::vector<RemoteCursor> establishShardCursors(
getDesiredRetryPolicy(opCtx));
}
-std::set<ShardId> getTargetedShards(OperationContext* opCtx,
+std::set<ShardId> getTargetedShards(boost::intrusive_ptr<ExpressionContext> expCtx,
bool mustRunOnAllShards,
const boost::optional<CachedCollectionRoutingInfo>& routingInfo,
const BSONObj shardQuery,
@@ -224,14 +224,14 @@ std::set<ShardId> getTargetedShards(OperationContext* opCtx,
if (mustRunOnAllShards) {
// The pipeline begins with a stage which must be run on all shards.
std::vector<ShardId> shardIds;
- Grid::get(opCtx)->shardRegistry()->getAllShardIds(opCtx, &shardIds);
+ Grid::get(expCtx->opCtx)->shardRegistry()->getAllShardIds(expCtx->opCtx, &shardIds);
return {std::make_move_iterator(shardIds.begin()), std::make_move_iterator(shardIds.end())};
}
// If we don't need to run on all shards, then we should always have a valid routing table.
invariant(routingInfo);
- return getTargetedShardsForQuery(opCtx, *routingInfo, shardQuery, collation);
+ return getTargetedShardsForQuery(expCtx, *routingInfo, shardQuery, collation);
}
/**
@@ -800,7 +800,7 @@ DispatchShardPipelineResults dispatchShardPipeline(
const auto collationObj = expCtx->getCollatorBSON();
const bool mustRunOnAll = mustRunOnAllShards(expCtx->ns, hasChangeStream);
std::set<ShardId> shardIds =
- getTargetedShards(opCtx, mustRunOnAll, executionNsRoutingInfo, shardQuery, collationObj);
+ getTargetedShards(expCtx, mustRunOnAll, executionNsRoutingInfo, shardQuery, collationObj);
// Don't need to split the pipeline if we are only targeting a single shard, unless:
// - There is a stage that needs to be run on the primary shard and the single target shard
@@ -858,7 +858,7 @@ DispatchShardPipelineResults dispatchShardPipeline(
}
// Rebuild the set of shards as the shard registry might have changed.
shardIds = getTargetedShards(
- opCtx, mustRunOnAll, executionNsRoutingInfo, shardQuery, collationObj);
+ expCtx, mustRunOnAll, executionNsRoutingInfo, shardQuery, collationObj);
}
// If there were no shards when we began execution, we wouldn't have run this aggregation in the