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: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution
    • 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.

      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:
            Unassigned Unassigned
            Reporter:
            haley.connelly@mongodb.com Haley Connelly
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: