[SERVER-55331] Time-series tests can retrieve buckets out of order Created: 19/Mar/21  Updated: 29/Oct/23  Resolved: 07/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Gregory Noma Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-56637 update sort order in buckets collecti... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2021-05-17
Participants:

 Description   

In some of our time-series tests, we check the underlying buckets and expect a certain order by sorting by _id. Note that the timestamp in the _id is only precise to the second. This is typically fine, as the counter at the end of the _id will ensure the bucket order is maintained. However, consider the case where the counter overflows back to 0 across two buckets whose minimum time are within the same second. In this scenario, the second bucket will end up sorting before the first, breaking this bucket ordering assumption.

Two potential solutions are:

  • Sort by control.min[timeFieldName], which maintains the original millisecond precision of the timestamps, or by control.min._id (assuming the individual documents' ids are ordered), rather than _id.
  • Manually select the timestamps so that the buckets are always at least one second apart.


 Comments   
Comment by Githook User [ 06/May/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-55331 fix sort order in timeseries tests when querying buckets collection
Branch: master
https://github.com/mongodb/mongo/commit/37bb3ea1b31581d8a54c8f5f5f4159b6a669d480

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