[SERVER-56676] improve handling of large/NaN values for expireAfterSeconds TTL index option Created: 05/May/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: Benety Goh Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-68283 Different behavior on arm64 for inval... Closed
Problem/Incident
Related
related to SERVER-60607 improve handling of large/NaN values ... Closed
related to SERVER-68359 Prevent TTLMonitor from processing in... Closed
related to SERVER-68522 Prevent 5.0 binary from starting in F... Closed
is related to SERVER-61321 Improve handling of large/NaN values ... Closed
is related to SERVER-54007 Perform TTL deletions on clustered in... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2
Sprint: Execution Team 2021-05-17
Participants:
Case:
Linked BF Score: 115

 Description   

The TTLMonitor is responsible for removing expired documents from a collection with a TTL index. The expireAfterSeconds option is a numerical value that is used to calculate the expiration time for removing documents.

Currently, the TTLMonitor ensures that this option is a numerical type but does not check for NaN or values that exceed the range of a long long type.

To handle existing TTL indexes that may contain unrepresentable values, we should consider extracting the expireAfterSeconds option using BSON::safeNumberLong() instead. We would still be able to evaluate a reasonable expiration time from the safely converted numerical value.



 Comments   
Comment by Githook User [ 27/Jul/22 ]

Author:

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

Message: Revert "SERVER-56676 TTLMonitor handles NaN/out of range values when extracting expireAfterSeconds"

This reverts commit 8ff8a14216bef7f7d6fd7720a9727886f529e287.
Branch: v4.4
https://github.com/mongodb/mongo/commit/7b9299a77fe5fa76b4e019575f38c21ff990c86b

Comment by Githook User [ 27/Jul/22 ]

Author:

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

Message: Revert "SERVER-56676 TTLMonitor handles NaN/out of range values when extracting expireAfterSeconds"

This reverts commit 921c4514352f572bc64b78f068d765206c12e301.
Branch: v4.2
https://github.com/mongodb/mongo/commit/eef44cd56b1cc11e5771736fa6cb3077e0228be2

Comment by Githook User [ 27/Jul/22 ]

Author:

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

Message: SERVER-56676 TTLMonitor handles NaN/out of range values when extracting expireAfterSeconds

(cherry picked from commit daa37e38c73b0eed3ef91d7156e71f7aa6028e42)
Branch: v4.2
https://github.com/mongodb/mongo/commit/921c4514352f572bc64b78f068d765206c12e301

Comment by Benety Goh [ 27/Jul/22 ]

The 4.4 and 4.2 backports do not use the safeExpirationDate() function added in SERVER-54007, which was intended to handle time-series collections. This does not change the calculation of the TTL expiration.

Comment by Githook User [ 26/Jul/22 ]

Author:

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

Message: SERVER-56676 TTLMonitor handles NaN/out of range values when extracting expireAfterSeconds

(cherry picked from commit daa37e38c73b0eed3ef91d7156e71f7aa6028e42)
Branch: v4.4
https://github.com/mongodb/mongo/commit/8ff8a14216bef7f7d6fd7720a9727886f529e287

Comment by Githook User [ 06/May/21 ]

Author:

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

Message: SERVER-56676 TTLMonitor handles NaN/out of range values when extracting expireAfterSeconds
Branch: master
https://github.com/mongodb/mongo/commit/daa37e38c73b0eed3ef91d7156e71f7aa6028e42

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