[SERVER-82643] [CQF] uasserts when memo encounters multiple empty value scans in different groups Created: 31/Oct/23  Updated: 05/Jan/24

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ben Shteinfeld Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Operating System: ALL
Sprint: QO 2023-12-11, QO 2023-12-25
Participants:

 Description   

To reproduce:

 

// In bonsai M2 mode
db.c.drop()
db.c.insert({a: {b: 1}})
db.c.createIndex({"a.b": 1})
db.c.find({$and: [{a: {$elemMatch: {b: {$elemMatch: {$gte: 1, $lte: 4}}}}}, {"a.b": {$in: [2, 5]}}]}).hint({$natural: 1})

 

// In bonsai M4 mode
db.c.drop()
db.c.insert({a: {b: 1}})
db.c.createIndex({"a.b": 1})
db.c.find({$and: [{a: {$elemMatch: {b: {$elemMatch: {$gte: 1, $lte: 4}}}}}, {"a.b": {$in: [2, 5]}}]})

 

This results in a uassert that we are inserting an empty value scan into the memo when such a node already exists in the memo in a different group. This occurs due to a combination of rewrites (filter decomposition, multikeyness simplification and filter substitution) resulting in multiple groups being simplified to an empty value scan.

Some options we should consider are relaxing this assertion, allowing identical groups to be merged, and inserting a delegator to the other group in such a case.

 


Generated at Thu Feb 08 06:49:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.