[SERVER-66727] Time-series bucket can be created that violates max time-span Created: 24/May/22  Updated: 29/Oct/23  Resolved: 03/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.0-rc7
Fix Version/s: 5.0.10, 6.0.0-rc10, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: James Wahlin 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
Problem/Incident
Related
is related to SERVER-66469 Filtering timeseries with date-field ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0, v5.0
Steps To Reproduce:

> db.weather.drop()
false
> db.createCollection(     "weather",     {        timeseries: {           timeField: "timestamp",           metaField: "metadata",           granularity: "hours"        }     } )
{ "ok" : 1 }
> db.weather.insertMany( [    {       "metadata": { "sensorId": 5578, "type": "temperature" },       "timestamp": ISODate("2105-06-24T06:28:16Z"),       "temp": 12    }])
{
	"acknowledged" : true,
	"insertedIds" : [
		ObjectId("628d0c27231ed7a35f109c7f")
	]
}
> db.weather.insertMany( [    {       "metadata": { "sensorId": 5578, "type": "temperature" },       "timestamp": ISODate("1969-05-18T00:00:00.000Z"),       "temp": 12    }])
{
	"acknowledged" : true,
	"insertedIds" : [
		ObjectId("628d0c31231ed7a35f109c81")
	]
}
> db.system.buckets.weather.find()
{ "_id" : ObjectId("fed30f004d9e3cfa51f88755"), "control" : { "version" : 1, "min" : { "_id" : ObjectId("628d0c27231ed7a35f109c7f"), "timestamp" : ISODate("1969-05-18T00:00:00Z"), "temp" : 12 }, "max" : { "_id" : ObjectId("628d0c31231ed7a35f109c81"), "timestamp" : ISODate("2105-06-24T06:28:16Z"), "temp" : 12 } }, "meta" : { "sensorId" : 5578, "type" : "temperature" }, "data" : { "_id" : { "0" : ObjectId("628d0c27231ed7a35f109c7f"), "1" : ObjectId("628d0c31231ed7a35f109c81") }, "timestamp" : { "0" : ISODate("2105-06-24T06:28:16Z"), "1" : ISODate("1969-05-18T00:00:00Z") }, "temp" : { "0" : 12, "1" : 12 } } }
> 

Sprint: Execution Team 2022-05-30, Execution Team 2022-06-13
Participants:
Linked BF Score: 76

 Description   

The time-series bucket _id field contains bucket min time, which is held as an ObjectId in unix epoch form. Inserting dates prior to Jan 1st 1970 (which aren't supported by our ObjectId timestamp representation) leads to a value that represents a future date. It is possible to insert 2 measurements one with a pre-1970 date and one with a future date that are incorrectly included in the same bucket.



 Comments   
Comment by Githook User [ 24/Jun/22 ]

Author:

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

Message: SERVER-66727 Use full-precision timestamp for time-series bucketing decision
Branch: v5.0
https://github.com/mongodb/mongo/commit/be7d9cd2d857f8179af2be6e274cd4ff16c27ce7

Comment by Githook User [ 14/Jun/22 ]

Author:

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

Message: SERVER-66727 Use full-precision timestamp for time-series bucketing decision
Branch: v6.0
https://github.com/mongodb/mongo/commit/f275c61e5dc9cfd69be9099acbfc1b0553cd76bb

Comment by Githook User [ 03/Jun/22 ]

Author:

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

Message: SERVER-66727 Use full-precision timestamp for time-series bucketing decision
Branch: master
https://github.com/mongodb/mongo/commit/f468b49daa97f37a1e77ab98ecc6dfd0347e8d2a

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