Details
-
Bug
-
Resolution: Fixed
-
Blocker - P1
-
None
-
None
-
Fully Compatible
-
ALL
-
v5.1, v5.0
-
QO 2021-09-06, QO 2021-10-04, QO 2021-10-18, QO 2021-11-01, QO 2021-11-15
-
120
Description
Normally when a measurement field 'x' contains an array, the 'control.min.x' field on the bucket contains the min for each position in the array.
> db.events.find()
|
{ x: [0, 2] }
|
{ x: [3, 1] }
|
|
|
> db.system.buckets.events.find()
|
{
|
control: {
|
min: {x: [0, 1]},
|
max: {x: [3, 2]},
|
},
|
...
|
}
|
But if 'x' also contains non-arrays, then 'control.min.x' or 'control.max.x' will be a non-array:
> db.events.find()
|
{ x: [0, 2] }
|
{ x: [3, 1] }
|
{ x: 10 }
|
|
|
> db.system.buckets.events.find()
|
{
|
control: {
|
min: {x: 10},
|
max: {x: [3, 2]},
|
},
|
...
|
}
|
The predicate pushdowns don't account for this, so "multikey" queries can incorrectly exclude this bucket:
> db.events.find({ x: {$lt: 5} })
|
(no results)
|
|
|
// because internally:
|
> db.system.buckets.events.find({$expr: {$lt: ["$control.min.x", 5]}})
|
A similar thing can happen if 'x' is a mixture of objects and non-objects:
> db.events.find()
|
{ "time" : ..., "x" : ISODate("1970-01-01T00:00:00Z"), "_id" : ... }
|
{ "time" : ..., "x" : { "y" : ISODate("2021-01-02T11:59:59Z") }, "_id" : ...) }
|
|
|
> db.events.find({ 'x.y': {$gt: ISODate('2000-01-01')} })
|
(no results)
|
This happens because although 'control.max.x' is the max of 'x', 'control.max.x.y' is not the max of 'x.y'. ('control.max.x.y' is 'missing', but 'missing' < ISODate.)
Attachments
Issue Links
- is depended on by
-
SERVER-60672 Simpler pushdown when timeseries collection has no mixed-schema buckets
-
- Closed
-
- is related to
-
SERVER-60445 $_internalBucketGeoWithin on mixed types can miss some events
-
- Closed
-
-
SERVER-59163 Enable partial indexes on time-series collections
-
- Closed
-
-
SERVER-59740 Add more end-to-end tests for time-series measurement indexes
-
- Closed
-
- related to
-
SERVER-60017 Don't pushdown predicates on dotted paths and resolve array issues on timeseries collections
-
- Closed
-
-
SERVER-59305 Reject timeseries measurements with array values in indexed fields
-
- Closed
-
-
SERVER-69408 Add randomized testing for the mixed-type timeseries bug
-
- Closed
-