summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMartin Neupauer <martin.neupauer@mongodb.com>2019-01-23 16:25:03 -0500
committerMartin Neupauer <martin.neupauer@mongodb.com>2019-01-30 17:57:26 -0500
commita257327cc39aebfe0847abfb5f40867d52d4d6fe (patch)
tree50976fb27e9ea34eec9a14d1fe9514abc02313c4 /src/mongo
parent7b7d1d979f33251d368523446f53c46b23f6d5f0 (diff)
downloadmongo-a257327cc39aebfe0847abfb5f40867d52d4d6fe.tar.gz
SERVER-32666 Allow $graphLookup against a sharded collection to execute on mongos
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/document_source_graph_lookup.h9
-rw-r--r--src/mongo/db/pipeline/lite_parsed_document_source.h8
2 files changed, 8 insertions, 9 deletions
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.h b/src/mongo/db/pipeline/document_source_graph_lookup.h
index 5f1af60d2ce..1c7cdd55924 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup.h
+++ b/src/mongo/db/pipeline/document_source_graph_lookup.h
@@ -56,9 +56,16 @@ public:
GetModPathsReturn getModifiedPaths() const final;
StageConstraints constraints(Pipeline::SplitState pipeState) const final {
+ // TODO SERVER-27533 Until we remove the restriction of only performing lookups from mongos,
+ // this stage must run on mongos if the output collection is sharded.
+ HostTypeRequirement hostRequirement =
+ (pExpCtx->inMongos && pExpCtx->mongoProcessInterface->isSharded(pExpCtx->opCtx, _from))
+ ? HostTypeRequirement::kMongoS
+ : HostTypeRequirement::kPrimaryShard;
+
StageConstraints constraints(StreamType::kStreaming,
PositionRequirement::kNone,
- HostTypeRequirement::kPrimaryShard,
+ hostRequirement,
DiskUseRequirement::kNoDiskUse,
FacetRequirement::kAllowed,
TransactionRequirement::kAllowed);
diff --git a/src/mongo/db/pipeline/lite_parsed_document_source.h b/src/mongo/db/pipeline/lite_parsed_document_source.h
index 8f4b85168cc..fc3b88163f3 100644
--- a/src/mongo/db/pipeline/lite_parsed_document_source.h
+++ b/src/mongo/db/pipeline/lite_parsed_document_source.h
@@ -189,14 +189,6 @@ public:
return _requiredPrivileges;
}
- /**
- * Returns true if 'nss' is in the list of foreign namespaces for this DocumentSource. By
- * default, no involved namespace is allowed to be sharded.
- */
- bool allowShardedForeignCollection(NamespaceString nss) const {
- return (_foreignNssSet.find(nss) == _foreignNssSet.end());
- }
-
protected:
stdx::unordered_set<NamespaceString> _foreignNssSet;