From a257327cc39aebfe0847abfb5f40867d52d4d6fe Mon Sep 17 00:00:00 2001 From: Martin Neupauer Date: Wed, 23 Jan 2019 16:25:03 -0500 Subject: SERVER-32666 Allow $graphLookup against a sharded collection to execute on mongos --- src/mongo/db/pipeline/document_source_graph_lookup.h | 9 ++++++++- src/mongo/db/pipeline/lite_parsed_document_source.h | 8 -------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/mongo') 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 _foreignNssSet; -- cgit v1.2.1