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

Update fuzzer test unique indexes in light of differing $mod behavior between 7.0 and 7.3+

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • Fully Compatible
    • ALL
    • v8.0
    • QO 2024-04-01
    • 54

      https://jira.mongodb.org/browse/BF-32195 was caused by a partial unique index that includes this filter in an OR

      "$and" : [                                       
              {                                        
                      "obj.obj.obj.obj.obj.obj.num" : {
                              "$type" : "long"         
                      }                                
              }                                        
      ]  

      This query results in differing unique index behavior on the two versions.

      db.fuzzer.runCommand({ "update" : "fuzzer", "updates" : [ { "q" : {  }, "u" : [ { "$addFields" : { "obj.obj.obj.obj.obj.obj.num" : { "$mod" : [ NumberLong("314159265358979383"), 34928 ] } } } ], "multi" : true } ]})  

      The $mod on 7.0 produces a long (and so send every document in the collection to the index, resulting in a duplicate key error). On 7.3 / 8.0 it produces an int and does not result in a duplicate key error.

      https://jira.mongodb.org/browse/DEVPROD-5208 resolved a similar issue.

      Avoiding "$type" : "long" anywhere in a partial unique index's filter should resolve the issue.

            Assignee:
            timour.katchaounov@mongodb.com Timour Katchaounov
            Reporter:
            evan.bergeron@mongodb.com Evan Bergeron
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: