-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
Query 2019-01-28, Query 2019-02-25
-
45
We hit this invariant when dealing with wildcard indexes and a query on a multikey field:
This will be hit because the list of index bounds for the wildcard index contains a redundant index bound, (a range of values is covered by two bounds).
Reproduction:
db.mycoll.drop(); db.mycoll.createIndex({"$**":1}); db.mycoll.insert({a:[1,2,3]}); db.mycoll.count({ 'a.0.0.0':{ $exists: true }});
This produces this failure:
INVALID BOUNDS: field #0['$_path']: ["a.0.0", "a.0.0"], ["a.0.0.", "a.0.0/"), ["a.0.0.0", "a.0.0.0"], ["a.0.0.0.", "a.0.0.0/"), field #1['a.0.0.0']: [MinKey, MaxKey]kp = { $_path: 1.0, a.0.0.0: 1.0 }}}{{scanDir = 1
These bounds are wrong because "a.0.0/" in the second bound pair is greater than "a.0.0.0" in the third pair. (Comparison is done by string comparison). Check out attached BF for the full backtrace!
There exists code which is supposed to account for the case of redundant index bounds for a multi-key field, and prune the redundant index bound.
However, this logic does not capture the case above. To complete this ticket will involve changing this logic to act correctly when seeing the case above.