diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/pipeline/document_source_sequential_document_cache.cpp | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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 | 18 |
1 files changed, 9 insertions, 9 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 535c3f5d2be..33c32f096b3 100644 --- a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp +++ b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp @@ -41,6 +41,7 @@ DocumentSourceSequentialDocumentCache::DocumentSourceSequentialDocumentCache( const boost::intrusive_ptr<ExpressionContext>& expCtx, SequentialDocumentCache* cache) : DocumentSource(kStageName, expCtx), _cache(cache) { invariant(_cache); + invariant(!_cache->isAbandoned()); if (_cache->isServing()) { _cache->restartIteration(); @@ -80,10 +81,9 @@ DocumentSource::GetNextResult DocumentSourceSequentialDocumentCache::doGetNext() Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOptimizeAt( Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) { - // The DocumentSourceSequentialDocumentCache relies on all other stages in the pipeline being at - // the final positions which they would have occupied if no cache stage was present. This should - // be the case when we reach this function. The cache should always be the last stage in the - // pipeline pre-optimizing. + // The DocumentSourceSequentialDocumentCache should always be the last stage in the pipeline + // pre-optimization. By the time optimization reaches this point, all preceding stages are in + // the final positions which they would have occupied if no cache stage was present. invariant(_hasOptimizedPos || std::next(itr) == container->end()); invariant((*itr).get() == this); @@ -96,7 +96,7 @@ Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOpt _hasOptimizedPos = true; // If the cache is the only stage in the pipeline, return immediately. - if (itr == container->begin() && std::next(itr) == container->end()) { + if (itr == container->begin()) { return container->end(); } @@ -153,12 +153,12 @@ Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOpt return container->end(); } -Value DocumentSourceSequentialDocumentCache::serialize(const SerializationOptions& opts) const { - if (opts.verbosity) { +Value DocumentSourceSequentialDocumentCache::serialize( + boost::optional<ExplainOptions::Verbosity> explain) const { + if (explain) { return Value(Document{ {kStageName, - Document{{"maxSizeBytes"_sd, - opts.serializeLiteral(static_cast<long long>(_cache->maxSizeBytes()))}, + Document{{"maxSizeBytes"_sd, Value(static_cast<long long>(_cache->maxSizeBytes()))}, {"status"_sd, _cache->isBuilding() ? "kBuilding"_sd |
