Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54042

Time-series collection queries return incorrect results when using CST

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Query Optimization
    • ALL

      While working on SERVER-53987 I came across these failures in my patch isolated to the cst_jscore_passthrough suite. I've disabled these tests in cst_jscore_passthrough.yml for the time being.

      Looking at the timeseries_bucket_limit_count.js failure, the query is returning incorrect results. We expect 1100 documents but only get 2.

      assert: [1100] != [2] are not equal : [ { "x" : 0, "_id" : 0 }, { "x" : 1000, "_id" : 1000 } ]
      doassert@src/mongo/shell/assert.js:20:14
      assert.eq@src/mongo/shell/assert.js:179:9
      runTest@jstests/core/timeseries/timeseries_bucket_limit_count.js:52:5
      @jstests/core/timeseries/timeseries_bucket_limit_count.js:93:1
      @jstests/core/timeseries/timeseries_bucket_limit_count.js:13:2
      

      I printed the explain() output, but couldn't see anything out of the ordinary:

       {
         "stages" : [
                 {
                         "$cursor" : {
                                 "queryPlanner" : {
                                         "plannerVersion" : 1,
                                         "namespace" : "timeseries_bucket_limit_count.system.buckets.t_1",
                                         "indexFilterSet" : false,
                                         "parsedQuery" : {
                                         },
                                         "queryHash" : "8B3D4AB8",
                                         "planCacheKey" : "8B3D4AB8",
                                         "maxIndexedOrSolutionsReached" : false,
                                         "maxIndexedAndSolutionsReached" : false,
                                         "maxScansToExplodeReached" : false,
                                         "winningPlan" : {
                                                 "stage" : "COLLSCAN",
                                                 "direction" : "forward"
                                         },
                                         "rejectedPlans" : [ ]
                                 }
                         }
                 },
                 {
                         "$_internalUnpackBucket" : {
                                 "exclude" : [ ],
                                 "timeField" : "time"
                         }
                 },
                 {
                         "$project" : {
                                 "_id" : true,
                                 "x" : true
                         }
                 },
                 {
                         "$sort" : {
                                 "sortKey" : {
                                         "_id" : 1
                                 }
                         }
                 },
                 {
                         "$project" : {
                                 "_id" : true,
                                 "x" : true
                         }
                 }
         ],
         "serverInfo" : {
                 "host" : "ip-10-122-10-73",
                 "port" : 20000,
                 "version" : "0.0.0",
                 "gitVersion" : "unknown"
         },
         "command" : {
                 "aggregate" : "system.buckets.t_1",
                 "pipeline" : [
                         {
                                 "$_internalUnpackBucket" : {
                                         "timeField" : "time",
                                         "exclude" : [ ]
                                 }
                         },
                         {
                                 "$sort" : {
                                         "_id" : 1
                                 }
                         },
                         {
                                 "$project" : {
                                         "x" : 1
                                 }
                         }
                 ],
                 "cursor" : {
                 },
                 "collation" : {
                         "locale" : "simple"
                 }
         },
         "ok" : 1
       }
      

      I suspect this may be an issue with the CST parser as it's only failing in the cst_jscore_passthrough suite for the all feature flags variant. I wonder if removing the _id index table on time-series collections triggered some unexpected behaviour.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: