Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit dac4044

Browse files
Martin NeupauerEvergreen Agent
authored andcommitted
SERVER-57281 SBE incorrectly constructs a collection scan instead of an
optimized oplog scan We will take into consideration the stopApplyingFilterAfterFirstMatch flag when deciding to contruct an optimized oplog scan.
1 parent 7bcd87d commit dac4044

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/mongo/db/query/sbe_stage_builder_coll_scan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ std::pair<std::unique_ptr<sbe::PlanStage>, PlanStageSlots> generateOptimizedOplo
363363
// inner branch, and the execution will continue from this point further on, without
364364
// applying the filter.
365365
if (csn->stopApplyingFilterAfterFirstMatch) {
366-
invariant(csn->minRecord);
367366
invariant(csn->direction == CollectionScanParams::FORWARD);
368367

369368
seekRecordIdSlot = recordIdSlot;
@@ -584,7 +583,7 @@ std::pair<std::unique_ptr<sbe::PlanStage>, PlanStageSlots> generateCollScan(
584583
PlanYieldPolicy* yieldPolicy,
585584
bool isTailableResumeBranch,
586585
sbe::LockAcquisitionCallback lockAcquisitionCallback) {
587-
if (csn->minRecord || csn->maxRecord) {
586+
if (csn->minRecord || csn->maxRecord || csn->stopApplyingFilterAfterFirstMatch) {
588587
return generateOptimizedOplogScan(state,
589588
collection,
590589
csn,

0 commit comments

Comments
 (0)