summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Neupauer <xmaton@messengeruser.com>2021-05-28 10:56:14 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-28 18:53:59 +0000
commitdac40446d6c44a806e5f20b67b7ce1b6bc0a87ad (patch)
treeda44f5fcc6fbc08caee8dbc35a3038c5230a9d83
parent7bcd87d2a68662003792c886ab1b341cad3c667f (diff)
downloadmongo-dac40446d6c44a806e5f20b67b7ce1b6bc0a87ad.tar.gz
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.
-rw-r--r--src/mongo/db/query/sbe_stage_builder_coll_scan.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mongo/db/query/sbe_stage_builder_coll_scan.cpp b/src/mongo/db/query/sbe_stage_builder_coll_scan.cpp
index 0d59e1df264..63c1a6aa697 100644
--- a/src/mongo/db/query/sbe_stage_builder_coll_scan.cpp
+++ b/src/mongo/db/query/sbe_stage_builder_coll_scan.cpp
@@ -363,7 +363,6 @@ std::pair<std::unique_ptr<sbe::PlanStage>, PlanStageSlots> generateOptimizedOplo
// inner branch, and the execution will continue from this point further on, without
// applying the filter.
if (csn->stopApplyingFilterAfterFirstMatch) {
- invariant(csn->minRecord);
invariant(csn->direction == CollectionScanParams::FORWARD);
seekRecordIdSlot = recordIdSlot;
@@ -584,7 +583,7 @@ std::pair<std::unique_ptr<sbe::PlanStage>, PlanStageSlots> generateCollScan(
PlanYieldPolicy* yieldPolicy,
bool isTailableResumeBranch,
sbe::LockAcquisitionCallback lockAcquisitionCallback) {
- if (csn->minRecord || csn->maxRecord) {
+ if (csn->minRecord || csn->maxRecord || csn->stopApplyingFilterAfterFirstMatch) {
return generateOptimizedOplogScan(state,
collection,
csn,