[SERVER-50638] Fix invariant failure in SlotBasedStageBuilder::buildOr() Created: 31/Aug/20  Updated: 29/Oct/23  Resolved: 13/Nov/20

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Drew Paroski Assignee: Drew Paroski
Resolution: Fixed Votes: 0
Labels: qexec-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-50373 Add support for covered projections i... Closed
is related to SERVER-49536 SBE stage builder is broken for SORT ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

 

> db.coll.insert(
 [{_id: 1, a: 8, b: 3, c: 4, d: 0},
 {_id: 2, a: 1, b: 5, c: 9, d: 1},
 {_id: 3, a: 6, b: 7, c: 2, d: 1},
 {_id: 4, a: 4, b: 8, c: 3, d: 0},
 {_id: 5, a: 9, b: 1, c: 5, d: 1},
 {_id: 6, a: 2, b: 6, c: 7, d: 0},
 {_id: 7, a: 3, b: 4, c: 8, d: 0},
 {_id: 8, a: 5, b: 9, c: 1, d: 0},
 {_id: 9, a: 7, b: 2, c: 6, d: 1},
 {_id: 10, b: 3, c: 4, d: 0},
 {_id: 11, a: 8, b: 3, d: 0},
 {_id: 12, a: 9, c: 5, d: 1},
 {_id: 13, a: 9, b: 1, d: 1}]);
> db.coll.createIndex({a: 1});
> db.coll.createIndex({b: 1});
> db.adminCommand({setParameter:1, internalQueryEnableSlotBasedExecutionEngine:true});
> db.coll.find({$or: [{a: {$gt: 6}}, {b: {$lt: 4}}]})

 

Sprint: Query 2020-09-07, Query 2020-09-21, Query 2020-10-05, Query 2020-10-19, Query 2020-11-02, Query 2020-11-16
Participants:

 Description   

When I was testing out using the $or operator in the first parameter to find() (with SBE mode enabled), I found a case where an invariant in SlotBasedStageBuilder::buildOr() fails.

The invariant that fails is "invariant(_data.resultSlot);" around line 350 of "src/mongo/db/query/sbe_stage_builder.cpp".

The goal of this task is to investigate why the invariant is failing, diagnose the underlying problem, and implement a fix.

When this issue is fixed, the "jstests/core/and_or_nested.js" should be updated to verify all of its queries work when there is both an index on field 'a' and an index on field 'b'.


Generated at Thu Feb 08 05:23:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.