diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
| commit | 294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch) | |
| tree | 279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/db/query/internal_plans.cpp | |
| parent | 70be7c27a251621187a1de533462ae2bb1e3bd39 (diff) | |
| parent | 1e917fd798aa25b7066d4b414b51184f13d5a092 (diff) | |
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10'
with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/db/query/internal_plans.cpp')
| -rw-r--r-- | src/mongo/db/query/internal_plans.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/mongo/db/query/internal_plans.cpp b/src/mongo/db/query/internal_plans.cpp index 04f70b1d2cc..78820eb8111 100644 --- a/src/mongo/db/query/internal_plans.cpp +++ b/src/mongo/db/query/internal_plans.cpp @@ -123,7 +123,8 @@ CollectionScanParams createCollectionScanParams( boost::optional<RecordId> resumeAfterRecordId, boost::optional<RecordIdBound> minRecord, boost::optional<RecordIdBound> maxRecord, - CollectionScanParams::ScanBoundInclusion boundInclusion) { + CollectionScanParams::ScanBoundInclusion boundInclusion, + bool shouldReturnEofOnFilterMismatch) { const auto& collection = *coll; invariant(collection); @@ -139,6 +140,7 @@ CollectionScanParams createCollectionScanParams( params.direction = CollectionScanParams::BACKWARD; } params.boundInclusion = boundInclusion; + params.shouldReturnEofOnFilterMismatch = shouldReturnEofOnFilterMismatch; return params; } } // namespace @@ -151,7 +153,8 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::collection boost::optional<RecordId> resumeAfterRecordId, boost::optional<RecordIdBound> minRecord, boost::optional<RecordIdBound> maxRecord, - CollectionScanParams::ScanBoundInclusion boundInclusion) { + CollectionScanParams::ScanBoundInclusion boundInclusion, + bool shouldReturnEofOnFilterMismatch) { const auto& collection = *coll; invariant(collection); @@ -167,7 +170,8 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::collection resumeAfterRecordId, minRecord, maxRecord, - boundInclusion); + boundInclusion, + shouldReturnEofOnFilterMismatch); auto cs = _collectionScan(expCtx, ws.get(), &collection, collScanParams); @@ -218,11 +222,19 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::deleteWith boost::optional<RecordIdBound> minRecord, boost::optional<RecordIdBound> maxRecord, CollectionScanParams::ScanBoundInclusion boundInclusion, - boost::optional<std::unique_ptr<BatchedDeleteStageBatchParams>> batchParams) { + std::unique_ptr<BatchedDeleteStageBatchParams> batchedDeleteParams, + const MatchExpression* filter, + bool shouldReturnEofOnFilterMismatch) { const auto& collection = *coll; invariant(collection); - auto ws = std::make_unique<WorkingSet>(); + if (shouldReturnEofOnFilterMismatch) { + tassert(7010801, + "MatchExpression filter must be provided when 'shouldReturnEofOnFilterMismatch' is " + "set to true ", + filter); + } + auto ws = std::make_unique<WorkingSet>(); auto expCtx = make_intrusive<ExpressionContext>( opCtx, std::unique_ptr<CollatorInterface>(nullptr), collection->ns()); @@ -237,14 +249,15 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::deleteWith boost::none /* resumeAfterId */, minRecord, maxRecord, - boundInclusion); + boundInclusion, + shouldReturnEofOnFilterMismatch); - auto root = _collectionScan(expCtx, ws.get(), &collection, collScanParams); + auto root = _collectionScan(expCtx, ws.get(), &collection, collScanParams, filter); - if (batchParams) { + if (batchedDeleteParams) { root = std::make_unique<BatchedDeleteStage>(expCtx.get(), std::move(params), - std::move(*batchParams), + std::move(batchedDeleteParams), ws.get(), collection, root.release()); @@ -454,12 +467,13 @@ std::unique_ptr<PlanStage> InternalPlanner::_collectionScan( const boost::intrusive_ptr<ExpressionContext>& expCtx, WorkingSet* ws, const CollectionPtr* coll, - const CollectionScanParams& params) { + const CollectionScanParams& params, + const MatchExpression* filter) { const auto& collection = *coll; invariant(collection); - return std::make_unique<CollectionScan>(expCtx.get(), collection, params, ws, nullptr); + return std::make_unique<CollectionScan>(expCtx.get(), collection, params, ws, filter); } std::unique_ptr<PlanStage> InternalPlanner::_indexScan( |
