diff options
author | Alya Berciu <alyacarina@gmail.com> | 2022-02-09 15:47:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-09 16:51:03 +0000 |
commit | 116a38b637faf897e1a6014abdaadff137cdb496 (patch) | |
tree | a425a26256b0908117bbcdb2d18f0fd45e686839 /src/mongo/db/pipeline/document_source_sequential_document_cache.cpp | |
parent | 7247b32842868333f42ca5b5920b28c88a206c03 (diff) | |
download | mongo-116a38b637faf897e1a6014abdaadff137cdb496.tar.gz |
SERVER-63141 Ensure stages without dependency tracking are not cached in $lookup
Diffstat (limited to 'src/mongo/db/pipeline/document_source_sequential_document_cache.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_sequential_document_cache.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp index a91be27fdd7..33c32f096b3 100644 --- a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp +++ b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp @@ -118,13 +118,14 @@ Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOpt DepsTracker deps(DepsTracker::kNoMetadata); // Iterate through the pipeline stages until we find one which cannot be cached. - // A stage cannot be cached if it either: 1. depends on a variable defined in this scope, or - // 2. generates random numbers. + // A stage cannot be cached if it either: + // 1. does not support dependency tracking, and may thus require the full object and metadata. + // 2. depends on a variable defined in this scope, or + // 3. generates random numbers. DocumentSource* lastPtr = nullptr; for (; prefixSplit != container->end(); ++prefixSplit) { - (*prefixSplit)->getDependencies(&deps); - - if (deps.hasVariableReferenceTo(varIDs) || deps.needRandomGenerator) { + if (((*prefixSplit)->getDependencies(&deps) == DepsTracker::State::NOT_SUPPORTED) || + deps.hasVariableReferenceTo(varIDs) || deps.needRandomGenerator) { break; } |