-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: 5.0.0-rc6
-
Component/s: None
-
Fully Compatible
-
ALL
-
v5.0
-
Execution Team 2021-07-12, Execution Team 2021-07-26
If the time-series granularity is increased via 'collMod', newly generated buckets will occupy larger time ranges. This means that queries on time fields also need to start considering larger ranges when scanning. That is currently not the case, as the bucketMaxSpanSeconds is hardcoded into the view pipeline, but it also needs to be updated in collMod.
The result of this bug is that queries will return incorrect results on time-series collections that have modified their 'granularity' setting with 'collMod'.
> db.createCollection("ts", {timeseries: {timeField: 't', granularity: 'seconds'}}) { "ok" : 1 } > db.runCommand({listCollections: 1, filter: {name: 'ts'}}) { "cursor" : { "id" : NumberLong(0), "ns" : "test.$cmd.listCollections", "firstBatch" : [ { "name" : "ts", "type" : "timeseries", "options" : { "timeseries" : { "timeField" : "t", "granularity" : "seconds", "bucketMaxSpanSeconds" : 3600 } }, "info" : { "readOnly" : false } } ] }, "ok" : 1 } > db.system.views.find() { "_id" : "test.ts", "viewOn" : "system.buckets.ts", "pipeline" : [ { "$_internalUnpackBucket" : { "timeField" : "t", "bucketMaxSpanSeconds" : 3600, "exclude" : [ ] } } ] } > db.runCommand({collMod: 'ts', timeseries: {granularity: 'minutes'}}) { "ok" : 1 } > db.runCommand({listCollections: 1, filter: {name: 'ts'}}) { "cursor" : { "id" : NumberLong(0), "ns" : "test.$cmd.listCollections", "firstBatch" : [ { "name" : "ts", "type" : "timeseries", "options" : { "timeseries" : { "timeField" : "t", "granularity" : "minutes", "bucketMaxSpanSeconds" : 86400 } }, "info" : { "readOnly" : false } } ] }, "ok" : 1 } > db.system.views.find() { "_id" : "test.ts", "viewOn" : "system.buckets.ts", "pipeline" : [ { "$_internalUnpackBucket" : { "timeField" : "t", "bucketMaxSpanSeconds" : 3600, "exclude" : [ ] } } ] }
Notice that the metadata for the time-series collection is updated, but not the view pipeline.
- is related to
-
SERVER-58186 [5.0] Temporarily disallow collMod from changing timeseries collection granularity
- Closed
- related to
-
SERVER-58350 Fix disabled Storage tests failing in multiversion suites due to changing latest release to 5.1
- Closed