[SERVER-73322] Wrong query result on sharded TS collection with custom collation due to incorrect predicate push down Created: 25/Jan/23  Updated: 02/Feb/24

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

Type: Task Priority: Major - P3
Reporter: Dan Larkin-York Assignee: Arun Banala
Resolution: Unresolved Votes: 0
Labels: greenerbuild
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-73024 Re-enable time-series sharded passthr... Closed
Assigned Teams:
Query Integration
Sprint: QI 2023-05-29, QI 2023-06-12, QI 2023-06-26, QI 2023-07-10, QI 2023-07-24, QI 2023-08-07, QI 2023-08-21, QI 2023-09-04, QI 2023-09-18, QI 2023-10-02, QI 2023-10-16, QI 2023-10-30, QI 2023-11-13, QI 2023-11-27, QI 2023-12-11, QI 2023-12-25, QI 2024-01-08, QI 2024-01-22, QI 2024-02-05, QI 2024-02-19
Participants:

 Description   

    db.createCollection(
        coll.getName(),
        {timeseries: {timeField: 'time', metaField: 'meta'}, collation: {locale: "en_US", numericOrdering: true, strength: 1}});
    
    // The 'numericOrdering' on the collection means that the max of the bucket with the three docs
    // below is "10" (while the lexicographic max is "5").
    coll.insert({time: ISODate(), meta: 42, value: "1"});
    coll.insert({time: ISODate(), meta: 42, value: "10"});
    coll.insert({time: ISODate(), meta: 42, value: "5"});
 
    // Should match "5" in lexicographic ordering.
    coll.find({value: {$gt: "4"}}).collation({locale: "en_US", strength: 1});

However, the query returns no results on sharded collection. This happens because the pipeline is optimized first on mongos, which isn't aware of potential collation mismatch, so it pushes the filter as {"control.max.value": {"$_internalExprGt" : "4"}} and ends up skipping the bucket when the filter is executed with non-numericOrdering collation.

After this bug is fixed, jstests/core/timeseries/nondefault_collation.js should be re-enabled in sharded suites.


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