[SERVER-68477] Improve NaN-handling for expireAfterSeconds TTL index parameter Created: 01/Aug/22 Updated: 29/Oct/23 Resolved: 30/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.0.14, 6.0.2, 6.1.0-rc1, 6.2.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dan Larkin-York | Assignee: | Benety Goh |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v6.1, v6.0, v5.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Execution Team 2022-08-08, Execution Team 2022-08-22, Execution Team 2022-09-05 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 54 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Issue Status as of Nov 15, 2022 ISSUE DESCRIPTION AND IMPACT In MongoDB 4.4 and earlier, TTL indexes with an expireAfterSeconds value of NaN (not-a-number) were functional as indexes for queries but did not expire any documents. When such a config is in place, the following error is logged by MongoDB 4.2 and 4.4 primary replica set nodes:
In MongoDB 5.0.0-5.0.13 and 6.0.0-6.0.1, as part of Because of this change in unspecified behavior, when a TTL index with this improper configuration exists, the following can trigger the sudden expiration of TTL-indexed documents in a collection:
Now that this issue is addressed, the following case may still present concern:
WORKAROUNDS AND REMEDIATION In general, avoid this issue by avoiding expireAfterSeconds: NaN as a configuration and correct this config anywhere it exists. The following script for the mongosh shell reports any TTL indexes with an expireAfterSeconds: NaN configuration: Note: Do not use the legacy mongo shell for this operation.
Once identified, correct any TTL indexes with the expireAfterSeconds: NaN configuration and establish an unambiguous, valid configuration with a specified behavior. The collMod command allows you to modify the expireAfterSeconds value for an existing index. MongoDB intends to help protect against this behavior change by:
Original descriptionCurrently listIndexes, and subsequently initial sync, do not properly handle NaN values for expireAfterSeconds. This can result in unexpected TTL behavior, especially when upgrading from MongoDB 4.4 to MongoDB 5.0 or when migrating earlier index definitions to MongoDB 5.0 or 6.0. |
| Comments |
| Comment by Githook User [ 12/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: These upgrade/downgrade restrictions were added in commit abdedd367e2f331816354563f8ae95f6bb35c51d |
| Comment by Githook User [ 12/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 58796facf40c99ddf8bb537adf563dc43aa0a863) |
| Comment by Githook User [ 12/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit b8eb75f99a18a8651e2315998cf16f53e48917bb) |
| Comment by Githook User [ 12/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit eb2f7f03f8c0522f85a9cae2c61bec4673251103) |
| Comment by Githook User [ 11/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit d6528bf96f08b79ca850902b2d1d81264fa7baa1) |
| Comment by Githook User [ 11/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry-picked from commit 14c07b53186ee88497abd0ba492d2d9157891718) (cherry picked from commit 7d76329f8915ec80ba07c07e4a0adbc7fd187107) |
| Comment by Githook User [ 11/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: Startup warning was added in 5.0 incommit abdedd367e2f331816354563f8ae95f6bb35c51d. (partially cherry-picked from commit abdedd367e2f331816354563f8ae95f6bb35c51d) (cherry picked from commit 5d21e0115edb120873c8beac2901e03a76ccfc00) |
| Comment by Githook User [ 10/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 3b17e5f7916fdf1a21dd162a079aeb9d06ca9425) |
| Comment by Githook User [ 10/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit cc3ae631bce7943fbda5182ff3b9d93d1125be40) |
| Comment by Githook User [ 10/Oct/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit f32f550aff1def5709ea68f42dc9d4bf9321d5e6) |
| Comment by Githook User [ 10/Oct/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: (cherry-picked from commit a59e32ba3883e46077a750d1f65f383e35ab3e12) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 58796facf40c99ddf8bb537adf563dc43aa0a863) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit b8eb75f99a18a8651e2315998cf16f53e48917bb) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit eb2f7f03f8c0522f85a9cae2c61bec4673251103) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit d6528bf96f08b79ca850902b2d1d81264fa7baa1) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry-picked from commit 14c07b53186ee88497abd0ba492d2d9157891718) (cherry picked from commit 7d76329f8915ec80ba07c07e4a0adbc7fd187107) |
| Comment by Githook User [ 11/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (partially cherry-picked from commit abdedd367e2f331816354563f8ae95f6bb35c51d) (cherry picked from commit 5d21e0115edb120873c8beac2901e03a76ccfc00) |
| Comment by Benety Goh [ 10/Sep/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: (cherry-picked from commit a59e32ba3883e46077a750d1f65f383e35ab3e12) |
| Comment by Githook User [ 10/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 3b17e5f7916fdf1a21dd162a079aeb9d06ca9425) |
| Comment by Githook User [ 10/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit cc3ae631bce7943fbda5182ff3b9d93d1125be40) |
| Comment by Githook User [ 10/Sep/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit f32f550aff1def5709ea68f42dc9d4bf9321d5e6) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 58796facf40c99ddf8bb537adf563dc43aa0a863) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit b8eb75f99a18a8651e2315998cf16f53e48917bb) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit eb2f7f03f8c0522f85a9cae2c61bec4673251103) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit d6528bf96f08b79ca850902b2d1d81264fa7baa1) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry-picked from commit 14c07b53186ee88497abd0ba492d2d9157891718) (cherry picked from commit 7d76329f8915ec80ba07c07e4a0adbc7fd187107) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (partially cherry-picked from commit abdedd367e2f331816354563f8ae95f6bb35c51d) (cherry picked from commit 5d21e0115edb120873c8beac2901e03a76ccfc00) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit 3b17e5f7916fdf1a21dd162a079aeb9d06ca9425) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit cc3ae631bce7943fbda5182ff3b9d93d1125be40) |
| Comment by Githook User [ 31/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry picked from commit f32f550aff1def5709ea68f42dc9d4bf9321d5e6) |
| Comment by Githook User [ 30/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 29/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 29/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 28/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 27/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (cherry-picked from commit 14c07b53186ee88497abd0ba492d2d9157891718) |
| Comment by Githook User [ 26/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: (partially cherry-picked from commit abdedd367e2f331816354563f8ae95f6bb35c51d) |
| Comment by Githook User [ 26/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 26/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |
| Comment by Githook User [ 25/Aug/22 ] |
|
Author: {'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}Message: |