[SERVER-45508] Invariant failure in getFieldsWithStringBounds with descending point ranges Created: 10/Jan/20  Updated: 29/Oct/23  Resolved: 22/Jan/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.2.6, 4.3.3, 4.0.19, 3.6.19

Type: Bug Priority: Major - P3
Reporter: David Percy Assignee: David Percy
Resolution: Fixed Votes: 0
Labels: afz
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2, v4.0, v3.6
Sprint: Query 2020-01-27
Participants:
Linked BF Score: 0

 Description   

It looks like the necessary ingredients to repro are:

  • a collation
  • multiple point ranges
  • the point ranges are indexed in descending order
  • more than one index can satisfy the query
  • the query asks for a sort within each point range

var coll = db.foo;
coll.drop();
db.createCollection(coll.getName(), {collation: {locale: 'fr'}});
coll.createIndex({x: -1});
coll.createIndex({x: -1, y: 1});
 
coll.find({x: {$in: [2, 5]}}).sort({y: 1}).toArray();



 Comments   
Comment by Githook User [ 28/May/20 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-45508 Fix crash when planning collated sort within multi point interval
Branch: v3.6
https://github.com/mongodb/mongo/commit/2af7fdacfa97c75b8ae7b5e6a28242dadf083d17

Comment by Githook User [ 22/Apr/20 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-45508 Fix crash when planning collated sort within multi point interval
Branch: v4.0
https://github.com/mongodb/mongo/commit/53d4c320668a0b880081c68836951259853c8364

Comment by Githook User [ 31/Mar/20 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-45508 Fix crash when planning collated sort within multi point interval
Branch: v4.2
https://github.com/mongodb/mongo/commit/ce1ca544dcc479b2638d83f3115994bf3da9de88

Comment by Githook User [ 22/Jan/20 ]

Author:

{'username': 'dpercy', 'name': 'David Percy', 'email': 'david.percy@mongodb.com'}

Message: SERVER-45508 Fix crash when planning collated sort within multi point interval
Branch: master
https://github.com/mongodb/mongo/commit/774c1e4a2f312e5e9470a551158ba175e0a25885

Comment by Vlad Rachev (Inactive) [ 14/Jan/20 ]

Makes sense, I had downloaded a binary from the mac-debug build.

Comment by David Percy [ 14/Jan/20 ]

This invariant is only checked in debug builds, which may be one reason why it hasn't come up yet. In a non-debug build, instead of a crash the planner could choose an index that results in the wrong sort order or bounds, for a string field.

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