Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92366

CollMod on 'expireAfterSeconds' is a no-op if new value is old value truncated to int

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution
    • Fully Compatible
    • ALL
    • Hide

      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.

      Show
      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.
    • Execution Team 2024-09-16, Execution Team 2024-10-14, Execution Team 2024-10-28

      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.

            Assignee:
            haley.connelly@mongodb.com Haley Connelly
            Reporter:
            haley.connelly@mongodb.com Haley Connelly
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: