Info
The InvalidTTLIndexFixer runs collMod on stepUp() to fix TTL indexes with invalid 'expireAfterSeconds' values.
In 7.3+, the InvalidTTLIndexFixer also tries to modify any non-int 'expireAfterSeconds' to be of type int via collMod.
However, the catalog doesn't get updated because the old expireAfterSeconds field is parsed as a 'safeNumberLong()', which makes it equivalent to the new expireAfterSeconds.
Top User Comments
xgen-internal-githook commented on Mon, 14 Oct 2024 13:18:42 +0000:
Author:
{'name': 'Haley Connelly', 'email': 'haley.connelly@mongodb.com', 'username': 'haleyConnelly'}
Message: SERVER-92366 CollMod can update 'expireAfterSeconds' double to its truncated int (#27893)
GitOrigin-RevId: 5c084464bc80ddc3d853a3ab3d1e2058e8b57ed8
Branch: master
https://github.com/mongodb/mongo/commit/8ecef16677794eee2e28411190cace206dd1a39e
Steps to Reproduce
Run ttl_non_int_expire_after_seconds.js and add the following lines before stopping the replica set.
rst.awaitReplication();
jsTest.log(`Printing catalog output of primary ${newPrimaryColl.aggregate([{$listCatalog: {}}]).toArray()}`)
The catalog output reveals the 'expireAfterSeconds' is still 10000.7 on the primary.
The test uses failpoints, but I suspect the issue could be recreated if the index is first created on a pre-7.3 version of mongod before it is upgraded to a new bin version.