[SERVER-63279] Pushing predicates on the time-series metaField past unpacking can cause incorrect results Created: 03/Feb/22  Updated: 29/Oct/23  Resolved: 11/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.2.0, 5.0.5
Fix Version/s: 5.3.0, 5.0.7, 5.2.2

Type: Bug Priority: Major - P3
Reporter: Dan Larkin-York Assignee: Dan Larkin-York
Resolution: Fixed Votes: 0
Labels: None
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:
v5.2, v5.0
Sprint: QO 2022-02-07, QO 2022-02-21
Participants:
Linked BF Score: 168

 Description   

We attempt to push predicates on the time-series metaField past the $_internalUnpackBucket stage so we can avoid unpacking buckets when possible. However, we may inadvertently push the predicate past another stage which may alter the document contents (e.g. $project) which can affect whether the document satisfies the predicate. For example:

[
    {$project: {measurement: 1}},
    {$match: {meta: {$lt: 100}}},
]

If we evaluate the predicate at the bucket level, we may get results, while if we evaluate after unpacking, we'll get an empty result set.



 Comments   
Comment by Githook User [ 25/Feb/22 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-63279 Prevent timeseries predicate test from running against v5.1
Branch: v5.2
https://github.com/mongodb/mongo/commit/69cf1448e3f015bc439d7fb526ddcfbf2fe2e5c5

Comment by Githook User [ 16/Feb/22 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-63279 Allow DocumentSourceInternalUnpackBucket to interoperate with DocumentSource::pushMatchBefore
Branch: v5.0
https://github.com/mongodb/mongo/commit/e3550719af7d4216e622cbf646ae1c1e989e4763

Comment by Githook User [ 11/Feb/22 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-63279 Allow DocumentSourceInternalUnpackBucket to interoperate with DocumentSource::pushMatchBefore
Branch: v5.2
https://github.com/mongodb/mongo/commit/773368690f6555464ef7a8c45973f5a3c709a71a

Comment by Githook User [ 11/Feb/22 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-63279 Allow DocumentSourceInternalUnpackBucket to interoperate with DocumentSource::pushMatchBefore
Branch: master
https://github.com/mongodb/mongo/commit/2d92ff7fe9a774746e5e34023256b71a5a95a722

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