[DOCS-15586] [Server] Improve NaN-handling for expireAfterSeconds TTL index parameter Created: 30/Aug/22 Updated: 13/Nov/23 Resolved: 30/Nov/22 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual |
| Affects Version/s: | None |
| Fix Version/s: | 6.0.2, 6.2.0-rc0, 6.1.0-rc1, 5.0.14, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Backlog - Core Eng Program Management Team | Assignee: | Dave Cuthbert (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Days since reply: | 1 year, 8 weeks, 2 days ago | ||||||||||||||||||||||||
| Epic Link: | DOCSP-22091 | ||||||||||||||||||||||||
| Description |
|
From: Investigate changes in Original Downstream Change Summary This is a good opportunity to review/clarify expireAfterSeconds in the docs:
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 and 6.0, 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:
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/Dec/22 ] |
|
Author: {'name': 'Dave Cuthbert', 'email': '69165704+davemungo@users.noreply.github.com', 'username': 'davemungo'}Message:
|
| Comment by Githook User [ 29/Nov/22 ] |
|
Author: {'name': 'Dave Cuthbert', 'email': '69165704+davemungo@users.noreply.github.com', 'username': 'davemungo'}Message:
|
| Comment by Githook User [ 29/Nov/22 ] |
|
Author: {'name': 'Dave Cuthbert', 'email': '69165704+davemungo@users.noreply.github.com', 'username': 'davemungo'}Message:
|
| Comment by Githook User [ 28/Nov/22 ] |
|
Author: {'name': 'Dave Cuthbert', 'email': '69165704+davemungo@users.noreply.github.com', 'username': 'davemungo'}Message:
|
| Comment by Eric Sedor [ 21/Nov/22 ] |
|
Thanks for catching this, dave.cuthbert@mongodb.com:
This exception refers to a "non-standard" downgrade path where you start a new node on 4.2/4.4 and add it to an otherwise 5.0/6.0 replica set (rather than downgrading binaries in place on existing replica set nodes). Does that clarify? FWIW I would suggest against documenting this path in detail as it's not our recommended downgrade method even in the absence of bugs. |
| Comment by Eric Sedor [ 18/Nov/22 ] |
|
Commenting here at dave.cuthbert@mongodb.com's request:
The notable exception to this is that we also added the "Now that this issue is addressed, the following case may still present concern..." section in the updated green summary box on Hopefully this makes sense! |
| Comment by Education Bot [ 12/Oct/22 ] |
|
Fix Version updated for upstream |
| Comment by Education Bot [ 12/Sep/22 ] |
|
Fix Version updated for upstream |
| Comment by Education Bot [ 31/Aug/22 ] |
|
Fix Version updated for upstream |
| Comment by Education Bot [ 30/Aug/22 ] |
|
Fix Version updated for upstream |